How to access the metadata node to add additional property on DAM UPDATE ASSET using custom workflow?
You can get required details like below
Session session = workflowSession.getSession();
// Get the Workflow data (the data that is being passed through for this work item)
final WorkflowData workflowData = workItem.getWorkflowData();
// Get the path to the JCR resource from the payload
final String payloadPath = workflowData.getPayload().toString();
ResourceResolver resourceResolver = null;
// Get the ResourceResolver from workflow session
resourceResolver = getResourceResolver(workflowSession.getSession());
Resource resource = resourceResolver.getResource(payloadPath);
// Using resource, we can read/update/add properties to required node by adapting to node or iterating to the required node and save the node by using session
// Add appropriate logger statements for checking errors
Hope this helps!
For adding custom properties to asset meta data, we need to add custom workflow process step to "Dam Update Asset" workflow.
Go to /libs/settings/workflow/models/dam/update_asset.html ,edit the workflow model ,add Process Step component and select your custom process step and save it.
For creating custom workflow, you can refer below
I created a process, added it to DAM UPDATE ASSET and it's all working fine. What I'm troubling with is how to access the metadata node in the execute() method to add properties to it.