Expand my Community achievements bar.

SOLVED

Asset schema - accessing data and manipulating it

Avatar

Level 6

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?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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.

View solution in original post

3 Replies

Avatar

Community Advisor

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

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(); 

 

Avatar

Correct answer by
Employee Advisor

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.