I am looking for some input from the community on the following question - Switch vs. Set Condition vs. State machine, what would you use and what have you used?
First let me give you my scenario. I have a Purchase Order requisition list created in SharePoint 2013 in an on premise installation. In the workflow I generate a PO number (this is working fine), but I have two conditions that I need to have the PO checked against. The conditions are as follows:
1. Is the PO under $10,000 or is it over $10,000.
2. Is the PO within the budget or is it not within the budget.
I have tried to configure the workflow using Set Conditions to evaluate the above two conditions where one Set Condition is nested below the other, see the screen capture below:
The issue here is that the PO validates against the first Set Condition and then by passes the second Set Condition. I have included the content of each Set Condition in screen captures below:
Is the PO under $10,000 or is it over $10,000.
Is the PO within the budget or is it not within the budget.
So I started to dig into the Nintex features and decided to try adding another State Machine to my workflow seeing that I already had a State Machine object in my workflow and it was working fine. The issue I am having with the second State Machine is that it is not completing properly and it only completes State 1 and does not move on to State 2. I have included screen shots of the second State Machine workflow and the out come.
State Machine Fail
Now I am wondering if using a Switch will work better than nested Set Conditions or a State Machine. If someone could provide some clarification on this question it would be appreciated. Even better if someone could share some examples of a workflow were they have used a Switch workflow object to evaluate multiple conditions that would be appreciated.
Solved! Go to Solution.
I've just looked at your set condition configuration and it's not properly configured..
In the action you have to set just one condition (Total is less than 10000 or Is this with budget? contains Yes), so when the workflow has to evaluate that condition, if the condition is met it proceed with the right branch of the set condition action otherwise it goes to the left branch.
The conditions you can set (using the AND and OR operator) will always evaluate together to get a final true/false result and depending on it the workflow will go in one of the branch.
In your case the workflow will always goes in the right branch because your conditions will always evalutate as true.
You should be good to go using a Set condition action. I tested it out and came up with the following:
If you look at your set condition action you'll see that you are using 'OR' so it will always evaluate as 'YES'. I suggest that you do it like this:
This way it evaluates as either YES or NO.
In regards to the State Machine, I would use this if the item is going through multiple 'states' in its life cycle. You could leverage this for if an item comes in as pending, it sits in a pending state until someone updates something, and then moves on to the next state. I try to use them rather than tasks as it keeps the approvals all in the same item rather than disconnecting the item and the task.
Thank you for the reply Jesse it is much appreciated.
I will review your suggestions and give it a try and see how it works out with my list and the workflow.
Thank you for your solution. I have worked thought your suggestions and it has been successful.
For now the Set Condition actions are working fine and giving me the results that I actually want.
I am very interested based on your comments to try the State Machine with this list and see if it makes to workflow more efficient then using Set Conditions.
If you have an example of a workflow similar to this using a State Machine I would be interested and it would also be very much appreciated to see how you crafted it.
But, for right now Jesse you rock!!