Introduction
The Nintex Workflow State Machine is a very useful piece of functionality. Not only is it a great enhancement to workflow design, it also improves the maintenance of a workflow in the future.
A State Machine Workflow is used when actions within a workflow need to be repeated by multiple parties and workflow advancement is dependent on the outcome.
Situation
Assume the AD-Document team needs to approve the document/item as in the following:
- Team1 needs to approve the document/item then Team2 and Team3 needs to approve the entire advertisement.
- Team1 approves the move to team2 and sends an email to the user and approver.
- If they reject sending an email to user and end the workflow.
- If Team2 rejects the work, it will be returned to Team1.
- Team 2 approves the move to team2 and sends an email to the user and approver.
- If they reject it then send an email to the user and move to Team1.
- If Team3 rejects the document/item then it is returned to the Team2 department.
- Team 3 approves the move to team2 and sends an email to the user and approver and ends the workflow.
- If they reject it then send an email to the user and move it to Team2.
Procedure
Here, we are creating a simple workflow that will allow for the process of creating an approval process. We require the Document to be approved by the Team1 and Team2 then finally the entire advertisement needs to be approved by Team3.
The first step is to drag a “State machine” action to the workflow designer, normally found in the “Logic and flow” set of actions. Your workflow should appear as it does below.
By default, two branches or states appear. Configure the action, as shown below, so that there are 3 states that are labeled and the state the state machine will begin with is “Team1”.
If you then go into the configuration window for the State Machine, you need to select the Initial State. This is the first state of the State Machine that the workflow will go into.
For the first approval level state, we send out an approval via the Request Approval. If the approver that I have set as the initiator just for testing approves the task, then we use the Change State action to change to the second Level Approval state and the same for Team3.
If Team1 rejects the task then we use a Send Notification action to notify the Initiator and then we add a Change State action to change to "End State Machine".
Here under Team1 you need to add a start task process action and an approved/rejected option available.
If you select the team 1 state then you have the option to move to the next state. Once team 1 approves then move to the next state.
The approval state looks as in this:
Then publish the workflow. And the workflow has been added to some list/library. Then you can add the workflow to manually or item created.
Then you will get the following mail, if the mail link is clicked then you will get the edit option in the SharePoint form and then you can approve/reject the item.