Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

How can I get the reference collections associated to an Asset in code

Avatar

Level 2

Hello,

 

I am looking to get access to collection's name that is referenced in the Asset details, screenshot attached.  Is there an OSGi service or approaches where I can get this information?

 

SajidAsset Collection.png

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Reply

Avatar

Community Advisor

Hi @sajidmomin ,
we can use AssetReferenceSearch

https://developer.adobe.com/experience-manager/reference-materials/6-4/javadoc/com/day/cq/dam/common...

 ReferenceSearch referenceSearch = new ReferenceSearch();
        referenceSearch.setExact(true);
        referenceSearch.setHollow(true);
        referenceSearch.setMaxReferencesPerPage(-1);
        Collection<ReferenceSearch.Info> resultSet = referenceSearch.search(resolver, assetPath).values();
        for (ReferenceSearch.Info info : resultSet) {
            //.......... iterate and
        }

Reference https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-assets-references-upda...

and if we want to consume in frontend we may use 

https://localhost:4502/bin/wcm/references?
_charset_=utf-8
&path=<path of the page>
&predicate=wcmcontent
&exact=false

Reference https://stackoverflow.com/questions/56991862/aem-querybuilder-getting-if-referenced
Thanks