Expand my Community achievements bar.

SOLVED

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

Avatar

Community Advisor

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

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

@Anmol_Bhardwaj  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

Avatar

Community Advisor

Hi @Anmol_Bhardwaj 

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?

Avatar

Community Advisor

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.

Avatar

Correct answer by
Employee Advisor

@Anmol_Bhardwaj  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

Avatar

Community Advisor

@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.

Avatar

Employee 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...

Avatar

Community Advisor
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.