Add property to DAM Asset metadata using custom workflow

Avatar

Avatar

jezwn

Avatar

jezwn

jezwn

30-11-2019

How to access the metadata node to add additional property on DAM UPDATE ASSET using custom workflow?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Ravi_Pampana

MVP

Avatar

Ravi_Pampana

MVP

Ravi_Pampana
MVP

01-12-2019

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!

Answers (2)

Answers (2)

Avatar

Avatar

Ravi_Pampana

MVP

Avatar

Ravi_Pampana

MVP

Ravi_Pampana
MVP

30-11-2019

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

Avatar

Avatar

jezwn

Avatar

jezwn

jezwn

30-11-2019

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.