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

Gaurav42
ServiceNow Employee
ServiceNow Employee

Hi Carl,

Not sure if you have tried the "Condition Script" under "Wait for condition" activity. Script gives you flexibility to put the conditions in the way you desire.

 

Hi Gaurav,

Yes I have tried that - worked on this for a while, the issue is the 'Wait for Condition' only allows a 'true' result so even if I have found the 'false' result it won't do anything until it matches the 'true' event.

Hi Carl,

As you see in my screenshot, I set a condition to wait until one field (u_check) is not set to false and it's working. You can see workflow is in execution mode and waiting the value to change to "false".

 

 

If it doesn't help, please share a screenshot so that we can have a deep dive. 

Regards - GS

 

Thanks for your reply Gaurav, although this isn't what I'm trying to achieve and sorry I may have not explained it well.

I need to check the status - if it changes to 'Status A' then return 'true' and do 'action A'.  However if the status changes and it 'isn't Status A' then return 'false' and do 'action B'.

So I can do a simple check where the condition is 'status IS "a"' and this works fine.  But I can't get it to check that the status field has been updated, and then check what the value is, and then return true or false.

Does that help clarify?