Expand my Community achievements bar.

SOLVED

URL Form content path

Avatar

Level 2

Hi, 

 

I am completely new to AEM and would need everyone help.

I am creating a form with 2 approval steps.. I can use the "assign task" in the WF but it only allows to view the submitted form in read-only mode. The approver can't change any data... So I would like to build a link that links to the submitted adaptive form with prefilled data that I use jcr:///... /Data.json protocol. Does anyone know how to get the url to the payload (content path) in the workflow? Appreciate any help.

 

Kong

1 Accepted Solution

Avatar

Correct answer by
Level 5
8 Replies

Avatar

Level 5

@SPMonkey  - Hoping this helps you

 

In AEM Workflow -With resource object in Java you should be able to get page path etc.

 

 

Pseudo Code 

******************************************

@Override
public final void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap args) throws
WorkflowException {

/* Get the Workflow Payload */

final WorkflowData workflowData = workItem.getWorkflowData();
final String type = workflowData.getPayloadType();

......

 

*******************************************************************

Avatar

Level 2

Hi Manjunathdj,

 

Thanks so much for the reply. I appreciate that.

 

Is there any OOTB feature that is available directly in the workflow so we can use and get the payload path/URL without creating a new bundle? We are trying to build a string that could be used in the notification email so when the approver receives an email, they can click on the link, modify the form and submit the form. The following screenshot has one part of the string we would like to build in the WF. Thanks much.

 

PS: I am completely new to AEM so please treat me like a baby when you give any instruction. I really appreciate your time and effort.

SPMonkey_0-1664802517076.png

 

Avatar

Correct answer by
Level 5

Avatar

Level 2

Sorry for a silly question. 

This is my workflow:

SPMonkey_2-1664808252943.png

In the "Send Email" action, I put the parameter ${payload.path}

SPMonkey_4-1664808303203.png

When i received the email, the link is incorrect. Could you help?

 

 

SPMonkey_0-1664808231132.png

 

${payload.path}

 

Avatar

Level 2

Assuming that I create a ECMA file with this code and call it in a Process step in the workflow, could you share how can I assign path to a workflow variable?

 

SPMonkey_0-1664810597338.png

 

Avatar

Level 5

@SPMonkey 

 

In java you can get payload as below and send email 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-6-5-workflow-notificat...

 

 

  @Override
    public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) {
        // Getting payload from Workflow - workItem -> workflowData -> payload
        String payloadType = workItem.getWorkflowData().getPayloadType();
        LOGGER.debug("{}: Payload type: {}", TAG, payloadType);

  

workItem.getWorkflowData().getPayload().toString()