paed01 / bpmn-engine

BPMN 2.0 execution engine. Open source javascript workflow engine.
MIT License
860 stars 166 forks source link

How to access variables of one task in the subsequent tasks #158

Closed MaheshkumarSundaram closed 1 year ago

MaheshkumarSundaram commented 1 year ago

Hi,

How do I access variables of one task in the subsequent tasks?

For example,

BPMN XML ``` Flow_1lphac8 Flow_1lphac8 Flow_0gsn4f8 Flow_0gsn4f8 Flow_174m0v1 Flow_174m0v1 Flow_1k8uh2k Flow_1k8uh2k ```

I have a user task followed by two service tasks. User Task: "Get the testing parameters from user" Service Task 1: "Run a service using the parameters" Service Task 2: "Produce a PDF Report"

Say, I get two parameters namely alpha_param & gamma_param from the user through an external form in User Task. How do I access those parameters in Service Tasks 1 & 2? Likewise, how do I access the output of Service Task 1 in 2?

Any help would be appreciated. Thanks!

paed01 commented 1 year ago

Sorry for the overdue answer.

You need to save to output/signal from the user task to environment.output. This can be done using extensions. If you are modeling your diagram with Camunda Modeler you can use onify/flow-extension as extension.