AEM Collections : Comprehensive Guide

AEM Collections are a set of assets bundled together, which can include different types of assets like images , pdf and videos  from different locations. Many times we face the requirement where a customer wants to share group of multiple types of assets with either internal or external clients, this can be achieved using aem collections. These collections can be shared with various users with edit level, owner level and viewer level privileges. A special thanks to Vernica Gupta for helping with this article.

There are two types of collection available in aem, based on how they collate assets:-

  • Collection – that contains a static reference list of assets, folders, and other collections.
  • Smart collection – that dynamically includes assets based on a search criteria.

After completing this tutorial, you will have a clear understanding about:-

Create Collection in AEM:-

Follow below steps to create aem collections :-

  • Click on the AEM logo on top left and select Assets.
  • On navigating to Assets select Collections.
  • Click on the Create button on the top right side of the Collection Console.
  • Enter title and description on Create Collection page.
  • The User creating the collection will be the owner by default.
  • You can add Users with which you want to Share the Collection depending on different roles. (Editor,Viewer,Owner).aem-assets-create-collection
  • Click Create and then click OK to close the dialog. A collection will be opened in the Collections console.

Note:-  If public collection checkbox is checked the Collection becomes public and need not be shared with any other user. This collection will be available to all the DAM Users group with the Viewer role.

Note:- To enable the members to share collections with other users, provide the dam-users group read permissions at the path home/users.

Below flow chart will help you to understand the life cycle of aem collections:-

AEM Collections Flow Chart – AEM CQ5 Tutorials

Adding Assets to Collection:-

The assets can be explicitly added to a Collection at any point of time. Follow below steps to add assets to a collection.

  • Navigate to Assets and select Files.
  • Navigate to specified folder, select any asset and click on To Collection icon.add assets collection aem
  • It will navigate to the Collections Console, select the collection to which you want to add the asset.
    AEM Assets Add To Collection
  • Click Add. The Asset gets added to the Collection.

How Collections data is stored in JCR :-

  • When we create a collection a node gets created in crx/de under /content/dam/collections, by the title specified while creating collection.collection node name jcr
  • When a collection gets created in JCR, sling:members node gets created which has property sling:resources that has reference of all the assets added to the collection.
    collection sling member node
  • A node demonstrating the asset added to the collection also gets created which again has the asset reference.
    collection asset node aem

Create Smart Collection in AEM :-

Smart Collections are the dynamic collections that uses a search criteria to dynamically populate assets.

  • Navigate to the Assets console, Assets –> Files and click the Search icon on the top right corner.
  • Enter search keyword and Press Enter.
  • From top left window select filter to expand left rail.
  • Select the filter criteria, if it is based on keywords. else leave it blank.create smart collection aem
  • Select one or more options you configured for the search facets. For example, select Images for File Types to search for images.
  • To create a Smart Collection from the search performed click on the Smart Collection button.
  • Enter the Collection Name and select Public to add the DAM Users group with the Viewer role to the smart collection.
    create dynamic collection aem
  • Clicking on Save will create a Smart Collection. The Smart Collection gets added to the Saved Search List. Any of the smart collection can be edited by selecting it from the Saved Searches List.

Now lets see how it stores the data.

How Smart Collections data is stored in JCR:-

Smart collection also store data under /content/dam/collections. Every smart collection when stored in JCR has a dam:query property which has the search query stored in it.

The assets of the smart collection are a result of this query execution. This is the reason why it is known as dynamic collection, as the results are dynamic depending on the data in AEM.

smart collection jcr data aem

Modify Smart Collection in AEM:-

Follow below steps to modify an existing smart collection :-

  • Navigate to Assets –> Files ( http://localhost:4502/assets.html/content/dam ).
  • Click on the search icon on the top right corner and press Enter.
  • Click on Filter icon on top left of page.modify smart collection saved search
  • From the Saved search drop down. Select your smart collection that you want to modify.(ex- dynamic collection)
  • Change the filter criteria as per your requirements. For ex:- Lets add multimedia file type also to our smart collection.
  • Select the Multimedia check box under File Type.update smart collection filters
  • Click on Edit Smart Collection on bottom of page.
  • Click on Save button to save the changes.
  • Edit Smart Collection pop up will open.
    • Select overwrite if you want to overwrite the collection.
    • Select Save as check box, if you want to save these changes as part of new smart collection, keeping older smart collection as it is. Enter name of new smart collection once you select the check box.

modify smart collection aem

  • Smart Collection success pop up gets displayed.

That’s it you have successfully modifies a existing smart collection.

Collection Groups in AEM :-

Whenever a collection is created there are three groups which gets created for each collection in aem.

  • mac-default-{name of collection}
  • mac-default-{name of collection}-owner
  • mac-default-{name of collection}-editor

mac-default-{name of collection} –  group is like a parent group with all the users that are assigned different levels of privileges on the collection.

mac-default-{name of collection}-owner – is the owner group with all the users that are assigned owner level privileges on the collection.

mac-default-{name of collection}-editor –  is the editor group with all the users that are assigned editor level privileges on the collection.

Hope you get a fair understanding of what aem collections are and how we can use them in aem. Please drop a comment below, if you want me to add more info about any particular topic related to aem collections here.

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.