send multiple paths as payload in workflow using java | Community
Skip to main content
Level 3
October 22, 2024
Solved

send multiple paths as payload in workflow using java

  • October 22, 2024
  • 2 replies
  • 957 views

I have seen a package path was sent as payload path when we want multiple paths as payload.

Now how to create package of multiple paths and send as payload in workflow using java.

 

I want to trigger a worflow using java with multiple paths as payload. Now how can i create a package of these paths and pass as payload to workflow.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

Hi @alisyed1 
When you add multiple payload, it creates a package kind node structure in JCR and replicate content from there.

If you want to achieve same, you need to do exactly the same using java

example: https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/main/java/com/adobe/acs/commons/workflow/impl/WorkflowPackageManagerImpl.java  

2 replies

arunpatidar
Community Advisor
Community Advisor
October 22, 2024
AliSyed1Author
Level 3
October 22, 2024

Sorry for the confusion I want to trigger workflow using java code.

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
October 22, 2024

Hi @alisyed1 
When you add multiple payload, it creates a package kind node structure in JCR and replicate content from there.

If you want to achieve same, you need to do exactly the same using java

example: https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/main/java/com/adobe/acs/commons/workflow/impl/WorkflowPackageManagerImpl.java  

Arun Patidar
EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
October 22, 2024

Hi, 

 

Adding to what @arunpatidar already explained, you would need to:

 

  1. Create a workflow package as Arun has pointed out.

  2. Start the workflow with the path of the package created in step 1 as the payload. Something like this should work:

 

WorkflowModel workflowModel = workflowSession.getModel("/var/workflow/models/yourModel"); WorkflowData wfData = workflowSession.newWorkflowData("JCR_PATH", "/path/to/your/wfPackage"); workflowSession.startWorkflow(workflowModel, wfData);

 

References:

https://experienceleague.adobe.com/en/docs/experience-manager-65/content/sites/administering/operations/workflows-starting#workflow-packages-for-batch-processing 

 

Hope this helps

Esteban Bustamante