Approval with Timeout Sample

Approval with Timeout

The approval process with a timeout is a bit more complicated. In this case, the Event-Based Gateway is used to create multiple paths. The first path to continue will win and all other paths will be terminated. To use the Event-Based Gateway, you need a begin and an end; one splits the paths and the other brings them back together. Once the paths are joined, you can proceed normally.

Step 1 – Drag the Start Event to the diagram

The name is optional, but it is useful to specify the module. In this case, the Accounts module has been selected and both new and existing records will be processed.

For the module filter, the Account Type is equal to Partner and the Account Type changed filter has been included.

The SQL filter is displayed for informational purposes. Changes in this window will be ignored.

Step 2 – Drag the Event-Based Gateway to the diagram, and connect

There are no parameters to the event-based gateway, nor are there paramters to the paths out of the gateway.

Step 3 – Drag the User Task to the diagram, and connect

The Approval Variable Name can be any name. It is an approval response, so it makes sense to give it that name. The name will be used in the SequenceFlow out of the gateway.

The User Task Type has been set to Approve/Reject and the User Assignment is set to Self-Service Team. This means that anyone on the Managers team can claim the record and approve or reject it.

Step 4 – Drag the Intermediate Timer Event to the diagram, and connect

It is always useful to put a description with the timer. In this case, the duration was set to 1 day.

Step 5 – Drag the joining Event-Based Gateway to the diagram, and connect

The two event-based gateways are the same, one just joins the previous paths.

Step 6 – Drag the Exclusive Gateway to the diagram, and connect

There are no settings on the gateway. Instead, the settings are on the paths out. With an Exclusive Gateway, you can have many outputs, with one being the default. The default path out has no filter expression.

Step 7 – Drag the End Message Event to the diagram

The message type has been set to Notification as we do not need to save this email in the CRM.

The source type is Normal message so that we can specify the subject and message template here, instead of having to create a message template.

In the Recipients list, Managers were added so that all managers will get the notice.

Step 8 – Connect the gateway to the end message and specify the filter

The filter that we will specify will be the variable name we created above and the value “Approve”. There are only two possible values, Approve and Reject and in this case we want to send an email for the approve path.

We use the double equal == here because this is C# syntax.

Step 6 – Drag the End Event to the diagram, and connect

The end event has no settings.