Expand my Community achievements bar.

Invoke dam update language copy workflow from custom workflow process by passing the language codes.

Avatar

Level 1

Tried to create a custom workflow for invoking the dam update language copy by passing the required language codes. I tried implementing  based on - https://medium.com/@vishalverma2110/programmatically-create-aem-translation-projects-981d060115c0

But this gives - failed to upload destination language from payload.

 

 

3 Replies

Avatar

Community Advisor

Hi,

 

What I could get from your query is that you want to pass the language nodes from the workflow step within the custom workflow that you are creating.

And from that custom workflow, the OOTB workflow "http://localhost:4502/editor.html/libs/settings/workflow/models/dam/dam-update-language-copy.html" needs to be triggered.

 

Code for invoking the workflow from the process step:

   // Workflow model path - This is the already created workflow
   final String model = "/var/workflow/models/dam/dam-update-language-copy";

   // Get the workflow model object
   final WorkflowModel workflowModel = workflowSession.getModel(model);

   // Create a workflow Data (or Payload) object pointing to a resource via JCR
   // Path (alternatively, a JCR_UUID can be used)
   final WorkflowData workflowData = workflowSession.newWorkflowData("JCR_PATH", payloadPath);

   // Optionally pass in workflow metadata via a Map
   final Map<String, Object> workflowMetadata = new HashMap<>();
   workflowMetadata.put("anyData", "You Want");
   workflowMetadata.put("evenThingsLike", new Date());

   // Start the workflow!
   workflowSession.startWorkflow(workflowModel, workflowData, workflowMetadata);

 

And for getting the language node:

1. either use the OSGi config or

2. pass the same via the set variable component available in the workflow or 

3. add the language nodes in the workflow dialog from the partcipant step and use that within the process step created above.

Thanks

Avatar

Level 1

HI Shailesh,

 

Thanks for the response. Here, the language code will be passed dynamically. We will be checking if the asset that is updated in the master copy exists in other languages and then only update the asset.