Asset schema - accessing data and manipulating it | Community
Skip to main content
New Participant
August 8, 2022
Solved

Asset schema - accessing data and manipulating it

  • August 8, 2022
  • 3 replies
  • 848 views

I have added a few fields in the properties tab of asset. i wanted to work with these fields and manipulate the data. What should be the approach?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by DEBAL_DAS

I believe after manipulation ,  you need to activate the modified assets also. Please correct me.

 

Option1> You can use bulk editor to manipulate/edit the values. No coding would be required. But you have to think about activation separately.

Option2> You can write a groovy script to access those fields and manipulate the data. You need to run the same script on author and publish instances individually. This will help you to avoid replication/activation process and we won't be seeing queues are stuck or queue is active - # pending if you are dealing with so huge number of assets.

 

No code deployment will be required. But you need to spend time to run the script on author and multiple publish instances individually.

 

 

Option3> As @sachin_arora_ has mentioned you can write a workflow and here you can incorporate approval process before publishing/activation. Code deployment would be required.

3 replies

DEBAL_DAS
DEBAL_DASAccepted solution
New Participant
August 9, 2022

I believe after manipulation ,  you need to activate the modified assets also. Please correct me.

 

Option1> You can use bulk editor to manipulate/edit the values. No coding would be required. But you have to think about activation separately.

Option2> You can write a groovy script to access those fields and manipulate the data. You need to run the same script on author and publish instances individually. This will help you to avoid replication/activation process and we won't be seeing queues are stuck or queue is active - # pending if you are dealing with so huge number of assets.

 

No code deployment will be required. But you need to spend time to run the script on author and multiple publish instances individually.

 

 

Option3> As @sachin_arora_ has mentioned you can write a workflow and here you can incorporate approval process before publishing/activation. Code deployment would be required.

Sachin_Arora_
New Participant
August 8, 2022

You can use workflows to do manipulation of the asset metadata. There are few workflows like XMP writeback which gets executed automatically once author saves properties or asset metadata. You can add custom workflow process step in the same workflow or create new one. 

If you create a new workflow, you need to add launcher so that workflow gets execute once data is updated on asset metadata(ASSET_PATH/jcr:content/metadata).

https://experienceleague.adobe.com/docs/experience-manager-learn/forms/adaptive-forms/custom-process-step-aem-workflow.html?lang=en

Code Snippet for update of Asset's title

Resource res = resourceResolver.getResource("/content/dam/test/asset.jpg");
Resource metadataRes =res.getChild("jcr:content/metadata");
ModifiableValueMap map = metadataRes.adaptTo(ModifiableValueMap.class);
//set metadata
map.put("dc:title", "Updated Title");
resourceResolver.commit(); 

 

New Participant
August 8, 2022

Hello @shaheena_sheikh ,

The properties of the asset(metadata) values will be stored in asset/jcr:content/metadata node. This can be programatically updated using by using below approaches

Reference: