I need to know if the community can lend some insight on using a Switch Action in a State Machine.
First some background - I have SharePoint 2013 on premise and Nintex Workflow 2013 Workgroup edition.
I have a custom list that I am using for Purchase Order Requisitions. This workflow is broken down into two sections - The approval process and the PO number generation process.
I have attached a JPG and a PDF of the current workflow that I am testing. The output is not pretty but you are able to get the idea of what I am trying to accomplish. I used the Nintex Workflow Analyzer to generate this image. For more information about the Workflow Analyzer read my post Export workflow to visio or visit Aaron Labiosa's Codeplex page at the link here - https://workflowanalyzer.codeplex.com/
The second half of the workflow, the PO number generation process works with no issues and it is a Switch Action that evaluates a variable that captures the company name at the beginning of the workflow.
I am having an issue in the first half of the workflow, when the workflow goes down a certain branch and hits the first Switch Action that I have in a State Machine. The switch is shown below in the screen capture.
In the configuration of the Switch I set the options as follows as seen below in he screen capture:
It evaluated the total of the PO that was captured in a variable called varTotal. This variable is created as a Single Line of Text. This did not work when using a variable. I then configured the Switch using the value in the total field directly as seen in the screen shot below:
Each time the workflow failed to continue processing once it hit the Switch action with either of the configurations.
I am looking for information and suggestions from the community about what the issue is with the Switch action inside the State Machine portion of the workflow an or how to configure the Switch that I have inside the State Machine.
I am also looking for suggestions and or tips on how to make this workflow more efficient or stream lined
Solved! Go to Solution.
What is the value of Total when the workflow enters the switch? The switch action is going to be looking at the value exactly as it is. If you are trying to do a switch on a ranged value, it will not work.
If you want to send me the actual workflow I can take a look at it for you and let you know if I see anything specific.
My email is
As Aaron says, the Switch action evaluates the exact value of a variable, not a range of values.
So your Switch will only validate if the value of your variable is either "1-10000", "10001-50000" or "50001".
If your variable is 5555 or anything like that, it will not evaluate it.
What you want is a couple of "Condition" actions that will evaluate whether your variable is > 1 and =< 10000, if yes then it continues on your chosen approval path, if no, another condition action evaluates whether your variable is > 10001 and =<50000. If yes then it continues on the relevant branch, if no then you know your variable is over 50001 and it can follow that branch. You'll end up with 2 actions (1 nested within the No branch of the first) and 3 possible outcomes.
The value of Total when the workflow enters the switch varies. The total field is the Total dollar value of the PO, so one PO could be $5000.00 or another PO could be $11,567.89 etc, etc.
This would explain why the second Switch Action that I have works so well for me as it is evaluating only a company name, which is an exact value and not a variable value as I have setup in the first Switch action.
As you requested I have sent you a copy of the workflow that I have created.
Thank you for your assistance and your answer Aaron.
Thank you for your reply. It is much appreciated.
Your description of the issue I am having is excellent. The question that I have for you is where would the condition(s) go that you are talking about? Would the Switch action be taken out of the State Machine and a set of conditions be added in to the State Machine to evaluate the Total field or a variable that I have setup called varPOTotal?
Can you please expand on your statement of how I would "nest" multiple conditions?
Thank you for your help Ryan.
You wouldn't use a switch at all, just a couple of Conditions, like so.
So the first condition is whether your variable is more than 1 but less than or equal to 10000.
Then the second condition is whether your variable is greater than or equal to 10001 but less than or equal 50000.
Ignore the third condition in the image, it's just the first image I found. If your second condition resolves to No then it's assumed that your variable is greater than 50000.