Ability for itil users to create catalog tasks ?

jleyco
Mega Contributor

Hello! We have a catalog item for "General Request" - where the intent is  to use this when we do not have an existing catalog item. Currently  our workflow is built to create 1  catalog task and  the RITM closes when that catalog task is closed. However, we want to give the fulfillment teams (itil users) the ability to create  additional catalog tasks if needed on this General Request. I've given them access to the "NEW"  button on the  sc_task.request_item related list that is on the RITM form. However,  when that first catalog task gets  closed - the RITM closes, even if there were additional catalog tasks created that are still open. The desired behavior would be for the General Request RITM to close only if all the  catalog tasks are closed.  

Any thoughts on how to accomplish this? Or even a different approach  to achieve the same goal (itil users able to create additional catalog tasks for  General Request)?

7 REPLIES 7

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Jessica,



You have to use "Wait for" condition activity in the workflow after "catalog task" activity with the script as


//Query for all tasks to see if they are inactive


var rec = new GlideRecord('sc_task');


rec.addQuery('request_item', current.sys_id);


rec.addNotNullQuery('wf_activity');


rec.addQuery('active', true);


rec.query();


if(rec.hasNext()){


answer = false;


}


else{


//Continue


answer = true;


}





Please refer below blog post for more detailed information.


https://www.servicenowguru.com/graphical-workflow/wait-closure-tasks-graphical-workflow/



Let me know if you are blocked.


Hi Pradeep - Thanks, this is useful for wf-generated tasks, but not manually created tasks.


Hi Jessica,



It looks like the suggestion from Pradeep will meet your requirements if you remove rec.addNotNullQuery('wf_activity');



This is the code from the link Pradeep provided: https://www.servicenowguru.com/graphical-workflow/wait-closure-tasks-graphical-workflow/



//Query for all tasks to see if they are inactive


var rec = new GlideRecord('sc_task');


rec.addQuery('request_item', current.sys_id);


rec.addQuery('active', true);


rec.query();


if(rec.hasNext()){


answer = false;


}


else{


//Continue


answer = true;


}



Thanks to Pradeep for identifying the solution,



Cody