Using \Run If\" in a state machine"

  • 9 September 2016
  • 8 replies
  • 9 views

Badge +1

Hello

I am making a workflow for the approval of new customers. Based on the credit rating that is filled in on the document 1 or more managers need to approve. So I when manager 1 has approved I want the WF to check the rating of the customer, if it is bad 1 or more managers higher up must approve as well.

 

In attachment you have an example. The conditions in my first "Run if" were met so the state should go to "Approval Business controller". But as there are different "Change State" actions the WF will always execute the last one.

Is there any way around this?

Thanks in advance for your assitance!

Thomas


8 replies

Badge +4

Thomas,

I do not think you are using the State Machine correctly. Here is one way you can make it work 

191344_pastedImage_1.png

You could also use "Switch" action in place of a state machine.

Userlevel 6
Badge +13

The Change State action only executes at the end of the State Branch, so as you have the End State Machine at the end running after your first Change State action, it will always override it.

If you were to put your End State Machine action in another Run If that would mean it wouldn't run unless that Run If condition was met.

There are possibly better ways of managing this process, but without seeing the entire process I wouldn't want to specualte on it.

Userlevel 5
Badge +12

Hello,

Always protect your Change State actions with conditionals (run if, condition yes / no) so that they are only executed accordingly and you will never have to worry.  This is a sure-fire way to making sure they execute the way you are expecting.

Thanks,

Mike

Badge +11

In the last one, add Run If around End State and the condition should not equal any of the other conditions listed.

Badge +1

Hello

Thank you all for you quick replies! I am a beginner so I am just looking for simple ways to get to what we need without having to bother our IT department.

My problem was that I need to change states based on combinations of conditions. So "set a condition" wouldn't really work. So as you said if I adjust the last "run if" action it seems to work fine.

 

The switch action looks interesting but I don't know where I should put my conditions.

I also thought about putting all possible combinations of conditions in a variable (state A, state B,..) and then use these to determine the branch, but that seemed to complicated.

Badge +11

The switch would replace the state machine.

Userlevel 5
Badge +12

Has your original question been answered?   If so can you mark a correct answer.  Also  if you have more questions, we have more answers happy.png

Badge +1

Yes, this answered my question. Thank you!

Reply