How to access the metadata node to add additional property on DAM UPDATE ASSET using custom workflow?
Solved! Go to Solution.
Views
Replies
Total Likes
You can get required details like below
//Get session
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;
try {
// 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
}catch(Exception e){
// Add appropriate logger statements for checking errors
}
Hope this helps!
Hi,
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
https://helpx.adobe.com/experience-manager/using/message_service_gateway_api_64.html
http://www.6dglobal.com/blog/creating-custom-CQ-workflow-process-step-2014-10-14
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.
Views
Replies
Total Likes
You can get required details like below
//Get session
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;
try {
// 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
}catch(Exception e){
// Add appropriate logger statements for checking errors
}
Hope this helps!
Views
Likes
Replies
Views
Likes
Replies