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 condition script

Sam Ogden
Tera Guru

Hi All,

I've created a new workflow for a catalog Item.   The Catalog item has 5 checkbox variables.   Each checkbox decides if a task is generated.   We have scenarios however that once the ITEM has been submitted we might need to manually create further tasks.

I've created a wait condition script to check all tasks are closed before moving to a run script to close the ITEM.

For example If 2 checkboxes on the catalog item were true, 2 tasks get generated.   We then manually create a 3rd task.

If the manually created task is closed before either of the workflow generated tasks the workflow works fine.

If the manually created task is the last task to be closed the workflow remains stuck at the wait condition.   If I then go into the workflow context and 'nudge' the workflow, the wait condition runs and the workflow completes.


Is there a way to amend the workflow or some other means to get the workflow to complete without having to manually nudge the workflow?

Below is the workflow and the wait condition script:

find_real_file.png

find_real_file.png

Any help is greatly appreciated

Thanks

Sam

1 ACCEPTED SOLUTION

Hi Andrii,



Thanks for all your help on this.   I have managed to get this working following trawling through many articles on here.   one had a link to the following:


Condition Activities - ServiceNow Wiki


section 4.4 example script got this working.



Thanks



Sam


View solution in original post

12 REPLIES 12

I think you case requires detailed troubleshooting.


Plus you may need to provide screenshot of your ritm's workflow when it hanged (there should be related link "Show Workflow") - that might be helpful as well.


Hi Andrii,



I've tried to detail below all the information, but let me know if there is anything else than can help to troubleshoot:



Business Rule



find_real_file.png


find_real_file.png


RITM



find_real_file.png


find_real_file.png


The workflow created SCTASK0051086 & SCTASK0051085.   I then Manually created SCTASK0051087.   Once all 3 tasks were open I then closed SCTASK0051086, then SCTASK0051085, then SCTASK0051087.   All of these were closed using the close task UI Action within each tasks form.



Workflow stuck at wait condition


find_real_file.png



Workflow Context


find_real_file.png



If I then nudge workflow from here it then completes:



find_real_file.png





find_real_file.png


Ok, I see. Good details.



Business Rule should solve this. May be there is something that omits business rule.



what is inside those "Catalog Task" boxes?


And what is inside Wait activity?


find_real_file.png