Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Can I get the value selected in standard tags in metadata schema?

AnmolBhardwaj1808
Level 2
Level 2

I want to get the value/values selected by an author when they select a standard tag in metadata schema.

 

Example: In the custom metadata schema for an asset, I have a tag field, where I have selected /content/cq:tags/test/1

 

I want to get this value "/content/cq:tags/test/1".

I have to apply this to the metadata field only, as I want to get this value for all the assets, not for a single one.

 

 

Here is my use-case:

 

  1. Created a metadata schema.
  2. Have added a standard tag field in the form of that schema.
  3. Have applied that schema to a folder in my DAM.

Requirement:

  • When the user uploads an asset inside that schema, they will have to fill the metadata created.( which includes the standard tag as well ).
  • What I want is to get the value/path of the tag which the user will select in that metadata.

 

AEM Version: 6.5

AEM AEM 6.5 AEM Assets Metadataschema
1 Accepted Solution
shelly-goel
Correct answer by
Community Advisor
Community Advisor

@AnmolBhardwaj1808  If you're programmatically looking to fetch this metadata, you can use below API and getAssetMetadata() method.

https://javadoc.io/doc/com.adobe.aem/aem-sdk-api/latest/com/adobe/granite/asset/api/Asset.html

 

The metadata is stored on node /jcr:content/metadata of the asset which you can verify in crxde

View solution in original post

6 Replies
Dipti_Chauhan
Community Advisor
Community Advisor

Hi @AnmolBhardwaj1808 

Can please you elaborate your question a bit more? What exactly your requirement? 

  • This tag field will be visible for all assets?
  • If its updated on one assets , it will get added on all assets by default?

this is what you are looking for?

AnmolBhardwaj1808
Level 2
Level 2

Hi @Dipti_Chauhan,

 

Here is my use-case:

 

  1. Created a metadata schema.
  2. Have added a standard tag field in the form of that schema.
  3. Have applied that schema to a folder in my DAM.

Requirement:

  • When the user uploads an asset inside that schema, they will have to fill the metadata created.( which includes the standard tag as well ).
  • What I want is to get the value/path of the tag which the user will select in that metadata.
shelly-goel
Correct answer by
Community Advisor
Community Advisor

@AnmolBhardwaj1808  If you're programmatically looking to fetch this metadata, you can use below API and getAssetMetadata() method.

https://javadoc.io/doc/com.adobe.aem/aem-sdk-api/latest/com/adobe/granite/asset/api/Asset.html

 

The metadata is stored on node /jcr:content/metadata of the asset which you can verify in crxde

View solution in original post

AnmolBhardwaj1808
Level 2
Level 2

@shelly-goelThis will only give me the metadata of a single asset right?

As I would be putting the path to a single asset.And need to write a new code or traverse through a lot of (child)nodes to get value for all of them. Which is not feasible in my case.

I need to fetch the value automatically for every asset that the user uploads. Sort of like a listener on the metadata field to get me the value every time.

shelly-goel
Community Advisor
Community Advisor
You can write this logic inside an event listener on node_added event so that everytime an asset is uploaded you get that asset's metadata. Here's the reference: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-listeners-events/qaq-p...
AnmolBhardwaj1808
Level 2
Level 2
Thanks. So I would need to put a NODE_ADDED/PROPERTY_ADDED listener to the dam folder and get the value of any new/updated asset from there? Understood. I was actually planning to put another tag field in the schema which will change it's rootPath depending upon the tag selected in the first tag dialog. I have a doubt whether this would work dynamically even before we save the metadata one.Let me try if this will work for that case. Will update here.