How can I get the reference collections associated to an Asset in code | Community
Skip to main content
Level 2
September 10, 2025
Solved

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

  • September 10, 2025
  • 1 reply
  • 1305 views

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?

 

Sajid

Best answer by MukeshYadav_

Hi @sajidmomin ,
we can use AssetReferenceSearch

https://developer.adobe.com/experience-manager/reference-materials/6-4/javadoc/com/day/cq/dam/commons/util/AssetReferenceSearch.html

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-update-programmatically/m-p/460441

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

1 reply

MukeshYadav_
Community Advisor
MukeshYadav_Community AdvisorAccepted solution
Community Advisor
September 11, 2025

Hi @sajidmomin ,
we can use AssetReferenceSearch

https://developer.adobe.com/experience-manager/reference-materials/6-4/javadoc/com/day/cq/dam/commons/util/AssetReferenceSearch.html

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-update-programmatically/m-p/460441

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