Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Workflow - wait for status change and then check status value and action accordingly

Carl Fransen1
Kilo Sage

Hi Team,

We question I'm hoping someone can assist with.  My current workflow moves to 'end' when the approvals are either accepted or rejected.  I'm wanting to add additional functionality to the  'rejected' path that waits for the status of an HR Case to change, then checks the status value, and if a particular value start the workflow again, if another value end the workflow.  

Check basically should do the below:

If it's 'a' perform action 'A' - if it's 'not a' perform action 'B'.

Currently I have used a 'Wait for Condition' however this only works for a 'true' value, it doesn't allow the adding of a 'false' value, as per the documentation.  I don't want to run a scheduled job every 'x' minutes to kick the workflow as it needs to occur when the status is changed.

Anyone know an easy way I can achieve the above?

Thanks

Carl.

1 ACCEPTED SOLUTION

Hi Carl,

I think in this case you need to create an additional activity "Switch" along with the "Wait for condition". Wait for condition will wait for the value to be changed and "Switch" activity will route to the task you need to do. You can try as in the screenshot:

 

 

 

 

 

View solution in original post

9 REPLIES 9

Hi Carl,

I think in this case you need to create an additional activity "Switch" along with the "Wait for condition". Wait for condition will wait for the value to be changed and "Switch" activity will route to the task you need to do. You can try as in the screenshot:

 

 

 

 

 

yea that could work, I will try this tomorrow and see if I can get it working.  I could use a condition that will always be true (it will only be called when the record is updated) and then the script to check only for status updates, then goto the script.

Will let you know how I get on.

Hi Gaurav,

I have tested this and it works well - it now waits until the state 'is not new' and then depending on the state it has when it's updated, the 'switch' will take the correct path.

Note that the 'Wait for condition' definitely ONLY allow a 'true' result, it doesn't allow for dealing with a 'false' or any other condition at all.

Thanks for your help.

Cheers Carl.

Raju Koyagura
Tera Guru

Did you try adding "Add Condition" to the activity?

 

find_real_file.png

 

 

find_real_file.png

Hi Raju,

Yes I tried that, as with my answer to Gaurav this doesn't seem to allow using the additional condition - from the documentation it seems it may not be possible. 

However it could have been my script I suppose....  I'm hoping someone can confirm if the documentation is correct that it only allows a 'true' condition for it to complete.