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.

Using workflows to prevent RITM closure

ShaziyaS4380655
Tera Contributor

Hi Community

 

i want to prevent RITM closure if it has any open tasks can this be achieved using Workflows , i can't use BUsiness rules into my instnce

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@ShaziyaS4380655 

workflows can't stop user from saving record.

So the only option is before update business rule on RITM which checks if it has any OPEN Catalog Task

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

2 REPLIES 2

Vishal_Jaiswal
Mega Guru

Hi @ShaziyaS4380655 ,

 

For best practice, you should use Business Rule, but as you said, you don't have access to that, so please follow the approach below.

1) Add an activity "Wait for condition" in your existing workflow and use the below script.

var answer = true;
var grTask = new GlideRecord('sc_task');
grTask.addQuery('request_item', current.getUniqueValue());
grTask.addQuery('active', true);
grTask.setLimit(1); 
grTask.query();

if (grTask.hasNext()) {
    answer = false; 
}

 

If my answer is useful, then mark it helpful or accept the solution.

 

Regards,

Vishal

Ankur Bawiskar
Tera Patron
Tera Patron

@ShaziyaS4380655 

workflows can't stop user from saving record.

So the only option is before update business rule on RITM which checks if it has any OPEN Catalog Task

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader