- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2025 05:13 PM
Hello Community,
I’m designing a flow in ServiceNow where I have three tasks using do the following in Parallel. (see screenshot)
- (x)
- (y)
- (z)
The z task cannot be closed unless either x or y tasks are in the " Close Complete" state. If either x or y tasks are still open , the "Close Task" button for the (z) task should be disabled.
How can I implement this in ServiceNow? Should I use a UI Action, Business Rule, or flow for this?
Thanks in advance for your help!
Regards,
Beyza
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2025 10:06 PM
Hi @beycos ,
You can create before business rule on task table and use below script.
var grTask = new GlideRecord('task'); // Replace 'task' with the appropriate table name
grTask.addEncodedQuery('parent='+current.parent+'^stateIN-5,1,2^sys_id!='+current.sys_id+''); // Fetch tasks X and Y
grTask.query();
if (grTask.next()) {
gs.addErrorMessage('Task Z cannot be closed until either Task X or Task Y is in the "Close Complete" state.');
current.setAbortAction(true);
}
When to run condition
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2025 09:51 PM
are you sure the group names are correct?
BR should be before update
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2025 09:51 PM
are you sure the group names are correct?
BR should be before update
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 03:29 PM
Thank you for your help. Is there a way to do this with Flow instead of BR?
Regards,
Beyza
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2025 10:06 PM
Hi @beycos ,
You can create before business rule on task table and use below script.
var grTask = new GlideRecord('task'); // Replace 'task' with the appropriate table name
grTask.addEncodedQuery('parent='+current.parent+'^stateIN-5,1,2^sys_id!='+current.sys_id+''); // Fetch tasks X and Y
grTask.query();
if (grTask.next()) {
gs.addErrorMessage('Task Z cannot be closed until either Task X or Task Y is in the "Close Complete" state.');
current.setAbortAction(true);
}
When to run condition
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2025 03:44 AM
Thank you for your response Runjay,
X, Y, and Z are all child tasks of the same parent task.
Regards,
Beyza
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2025 09:55 PM