How to setup workflow with approves
At first, let's assume that we have two request types:
- Main request
- Request for approve
The workflow for Main request could look like:
The Request for approve could look like:
Automatic creation of subrequests for approve
To illustrate the work with approves, we will generate two different requests for approve when main request reaches stage On Approve.
This could be done via automated action create for move on route from New to On Approve stage.
Let's create action to create first subrequest for approve
Let's create action for second subrequest for approve
Configuration of triggers and actions to automatically change stage of Main request when subrequests approved or not.
At fist, we have to create route trigger, that will automatically move parent request to stage In Progress if all subrequests approved.
As first step to create such trigger, we have to create Generic Condition that will describe when we need to move Main request to In Progress stage. This condition should be applied to Main request. This condition should be evaluated to True if following is True:
- This condition have to check all subrequests of request that do not have tag Used.
- This condition have to check that filtered subrequests has stage type Closed Ok
Below is configuration of such conditions:
Pay attention at "Invert (Not)" field
Next, let's create trigger
Also, we could make the route Approved to be auto-only, thus request could be moved to this stage only automatically via trigger.
Next, let's create one more route trigger that will move request from On Approve to New stage when at least one active subrequest closed with Close (Fail) stage type.
The condition for this case:
Pay attention to Related Field definition, it has operator Contains instead of Match as in previous condition, thus if at least one active subrequest Is closed(Fail), then this condition will be evaluated to True.
So, now we can create trigger for this case:
Note, that here, we can use conditons Subrequest Closed, instead of All subrequests closed, as in previous case. This is becase we can move request to next stage when first subrequest rejected, without need to wait for other subrequests closed.
Also, we mark this route as auto-only too.
Because we have used tag "Used" in our conditions, we have to set this tag on Requests for Approve automatically, when main request moves forward.
Thus we have to create action that will do it when request moves to any other stage from On Approve.
So, first, we need to create new stage type Approve, and assign it to On Approve stage of main request:
Next, we could create action that will automatically tag approve requests as used. It could look like: