User task after Signal Start Event lost variable

I have the below workflow:

Start → UserTaskA(with signal start event A) → 3 x Subprocess(boundary signal event A) → End

For the first run, UserTaskA which assignee is ${requester} can run with no problem.

In those 3 subprocess, there are 3 separate user task, if task disapproved, signal A should be triggered, and other 2 subprocess should be cancelled.

Then UserTaskA expected to be assigned to ${requester}, but it prompt error instead:
An error happened while submitting the task form : Cannot submit task form 26ea8605-420b-11ec-b635-0050569ea777: Unknown property used in expression: ${requester}. Cause: Cannot resolve identifier ‘requester’

May I know why the variable is loss after the signal start event?

Thanks.

Hi @john.ng,

It would be great if you can attach a snip of your visual model.

When you deliver a signal, the signal start event is triggered and so a new process instance is started.

You need to supply variables to new started process instance with the deliver signal call so in your case you need to supply requester as variable with the deliver signal call.

Hi @hassang,

Thanks for your reply.

My goal is having multiple parallel approval at the same time,
while any one of them has been rejected, others user task should be cancelled,
and return to User Input.

At the very beginning, I tried to link those boundary signals directly to the User Input task,
but in result 3 User Input tasks triggered.

So I tried to use signal start event, but seems it cannot carry previous variables back to the task?

Thanks.

Hi @john.ng,

Below is a simplified model.

  • “anyRejection” variable is initialized to false each time work returns to Task 1.

  • In case of rejection, a message is sent causing the work of all sub-processes to interrupt.

Below expression is used to send the message
#{execution.getProcessEngineServices().getRuntimeService().createMessageCorrelation("rejected_msg").processInstanceBusinessKey(execution.processBusinessKey).setVariable("anyRejection", true).correlateAll()}

Kindly find attached a running example
any-rejection-process.bpmn (19.5 KB)

Hi @john.ng,

In above example, messages are correlated on the businessKey so you need to supply a businessKey value when you start the process.

Hi @hassang,

May I know the difference to use signal vs message event in this case?

Thanks.

Hi @john.ng,

Note: The signal event does not perform any kind of correlation to a specific process instance. On the contrary, it is broadcast to all process instances

In your case, you need to correlate to a specific process instance. Why?
Let’s assume that two process instances of this model have been started then broadcast to all process instances means to interrupt sub-processes in both running instances even if rejection is happened in only one instance.

Hi @hassang,

I tried use a message named “Reject” for all message event in the model,
but unlike the signal event, no I am not abled to cancel all pending user task and redirect to User Input.

May I know the reason?

Thanks.

Hi @john.ng,

Do you mean that using messages doesn’t work?
Have you tried the example I attached?
Can you please share your bpmn file…

Thank you @hassang,
after using expression in message throw event,
it works as expected.

Really appreciate for you help. Cheers.

1 Like