Monday, May 25, 2015

#404 BPM use of Suspend in Event Sub-processes

Here is a simple example -

The logic here is simple -
I can no longer cancel an order if the ApproveOrder4Me task has been completed.
Thus the setting of a variable in the SetNoCancelAllowed activity.

Now to the event sub-process -
Here is the configuration of the Cancel activity

It is a suspending event -
Correlation has been defined based on the orderNr.

So first I check whether it is still possible to cancel the order.
If so, all I do is log the cancellation and then exit.

If not, I set the pre-defined process variable action to resume (note: lower case)

So now to the test -

I start an order process -

The process is waiting at the first human task, so I can still cancel.

I cancel -

I should see 2 instances of the composite in em -

I click on the first instance (430023)

I now test resumption after suspension -

I create a new order process instance -

I go to the first human task and APPROVE -

From a functional perspective, I should no longer be able to cancel,
The first human task has been executed and the process is now waiting at the 2nd.

But I try it anyway -

Now don't get confused by the human task name, I am reusing the same
human task for both activities.

I now go back to workspace and approve the second task -

I check the audit trail in em -

No comments: