Expand my Community achievements bar.

AEM workflow : How to update payload value using API

Avatar

Level 3

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

2 Replies

Avatar

Community Advisor

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



Arun Patidar

Avatar

Employee Advisor

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.