AEM workflow : How to update payload value using API

Avatar

Avatar

anuj_pathak1

Avatar

anuj_pathak1

anuj_pathak1

27-07-2018

I am wondering if anyone knows or used AEM api to dynamically update currently running workflow instance payload value.

We have a workflow which is started via workflow launcher with a payload "path A" and in next workflow step we modify path A value to path B (after applying some logic ) and now we want to set/update payload to path B which will be consumed by subsequent steps of same workflow instance.

I looked around but couldn't find a method like setPayload() or updatePayload() in WorkflowData like it has for getPayload().

Alternatively, I can walk through crx node of running workflow instance (var/workflow/instances/server0/xxxx/data/payload) and update payload property value but I would prefer any inbuilt method or API to do the same.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Avatar

Avatar

Jörg_Hoh

Employee

Total Posts

3.1K

Likes

1.0K

Correct Reply

1.1K

Avatar

Jörg_Hoh

Employee

Total Posts

3.1K

Likes

1.0K

Correct Reply

1.1K
Jörg_Hoh
Employee

28-07-2018

You should not change the payload of a workflow. While technically it's possible to do so via the JCR API, it's definitly not advised, because a lot of the workflow code is dependent on it.

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

3.1K

Likes

1.2K

Correct Reply

879

Avatar

Arun_Patidar

MVP

Total Posts

3.1K

Likes

1.2K

Correct Reply

879
Arun_Patidar
MVP

28-07-2018

Hi,

There is no dedicated API to update workflow payload.

You need to go with Node API to update payload node's path property.

Please check if you need to change currentPath property of a node of current workitems  as well.

Thanks

Arun