Comments on: Wait for Closure of all Tasks in Graphical Workflow https://servicenowguru.com/graphical-workflow/wait-closure-tasks-graphical-workflow/ ServiceNow Consulting Scripting Administration Development Tue, 28 May 2024 21:11:15 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: JR Guieb https://servicenowguru.com/graphical-workflow/wait-closure-tasks-graphical-workflow/#comment-7397 Fri, 17 Mar 2017 22:40:48 +0000 https://servicenowguru.wpengine.com/?p=1909#comment-7397 Hi Mark,

This works great but I noticed the RITM will close only the last task that is closed is a WF generated task.

If the last task that is closed is a manually created task the RITM stays open.

I tested this in our own instance and in a brand new developer instance. Is there a way around this?

]]>
By: Mark Stanger https://servicenowguru.com/graphical-workflow/wait-closure-tasks-graphical-workflow/#comment-7396 Thu, 27 Oct 2016 20:55:55 +0000 https://servicenowguru.wpengine.com/?p=1909#comment-7396 In reply to Heather.

My recommendation is what’s posted above. It really sounds like you’ve got some other issue in your system that might be causing a conflict with what’s been posted here.

]]>
By: Heather https://servicenowguru.com/graphical-workflow/wait-closure-tasks-graphical-workflow/#comment-7395 Thu, 27 Oct 2016 20:52:03 +0000 https://servicenowguru.wpengine.com/?p=1909#comment-7395 In reply to Mark Stanger.

I also am having an issue where the workflow generated task is closing the RITM, even if a manual task has been added before the completion of the workflow task. Using Join only appears to work for the taks that have been created in the workflow and has no impact on the manual task which still closes the RITM. I tried using the below wait for condition but now it is keeping the RITM open even if all tasks have been completed. Is there anything you recommend for this scenario?

]]>
By: Eric https://servicenowguru.com/graphical-workflow/wait-closure-tasks-graphical-workflow/#comment-7394 Wed, 16 Dec 2015 18:56:20 +0000 https://servicenowguru.wpengine.com/?p=1909#comment-7394 In reply to Mark Stanger.

I don’t know if it actually does work.

I allow users to create ahdoc tasks along with the ones generated in the workflow. I use a workflow activity with this script at the end so it makes sure all tasks, regardless of who created it, are closed. If I close all the workflow-generated tasks first, and then close the manual ones, it never closes out the RITM. If I make a change on the RITM and save it, then it moves forward. But otherwise it is stuck there indefinitely.

]]>
By: Mark Stanger https://servicenowguru.com/graphical-workflow/wait-closure-tasks-graphical-workflow/#comment-7393 Mon, 19 Oct 2015 13:16:06 +0000 https://servicenowguru.wpengine.com/?p=1909#comment-7393 In reply to Michel Hanna.

Good question. The wiki documentation, while technically correct, is also incomplete. The ‘Wait for’ condition is evaluated whenever the workflow context is re-evaluated. This happens on any update of the ‘current’ record, but it can also be invoked at other times from a script. There is an out-of-box business rule named ‘SNC – Run parent workflows’ that checks each record when it is de-activated and then triggers the evaluation of workflow contexts for any parent record. That’s why this solution works. Catalog tasks and Change tasks are linked to a parent record and they trigger the parent workflow context when they’re de-activated.

]]>
By: Michel Hanna https://servicenowguru.com/graphical-workflow/wait-closure-tasks-graphical-workflow/#comment-7392 Mon, 19 Oct 2015 00:54:37 +0000 https://servicenowguru.wpengine.com/?p=1909#comment-7392 Hi,
SN documentation (http://wiki.servicenow.com/index.php?title=Condition_Activities#Wait_for_condition) says that “The workflow evaluates the wait for condition each time the current record is updated.”
But looking at your Request Item ‘Wait For’ Scripts, the current record is Request Item and the workflow it is waiting for a change in another table (Task to be inactive), but I from my understanding that wouldn’t update the current record which is a Request Item, and hence it shouldn’t trigger the workflow to re-evaluate the waitfor condition.
I’m sure the examples you’ve provided are working fine, but I’m confused as to what triggers the workflow to evaluate the condition, if you please could verify.

Thanks,
Michel

]]>
By: Mark Stanger https://servicenowguru.com/graphical-workflow/wait-closure-tasks-graphical-workflow/#comment-7391 Wed, 16 Sep 2015 11:55:17 +0000 https://servicenowguru.wpengine.com/?p=1909#comment-7391 In reply to Juan Alfaro.

That’s a built-in behavior of the tool so you shouldn’t need to modify anything to make that work. If it’s not working then there’s been a change made to your system that’s broken it. I would compare what you’ve got with a clean demo instance and make sure all of the business rules on the requested item and request tables are the same.

]]>
By: Juan Alfaro https://servicenowguru.com/graphical-workflow/wait-closure-tasks-graphical-workflow/#comment-7390 Tue, 15 Sep 2015 21:14:32 +0000 https://servicenowguru.wpengine.com/?p=1909#comment-7390 Hello Mark,

Is there a similar script to use a wait for condition but on the request workflow? For example, for the request to be completed automatically once all requested items are completed?

Thanks in advance,
JP

]]>
By: Chandra Miller https://servicenowguru.com/graphical-workflow/wait-closure-tasks-graphical-workflow/#comment-7389 Fri, 13 Mar 2015 03:21:04 +0000 https://servicenowguru.wpengine.com/?p=1909#comment-7389 Thank you soo much! I have been looking for this code and so happy you have posted! This works much better than “Join”!

]]>
By: Mark Stanger https://servicenowguru.com/graphical-workflow/wait-closure-tasks-graphical-workflow/#comment-7388 Fri, 24 Jan 2014 12:41:21 +0000 https://servicenowguru.wpengine.com/?p=1909#comment-7388 In reply to Felipe Barbosa.

Not really. The workflow conditions are generally evaluated on updates to the associated records (which you definitely want to happen). If you’re seeing performance issues, then you probably need to look more closely at the number of workflows running and your overall workflow design.

]]>