How to create new Tasks on the existing RITMs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 06:51 AM
Hi All,
We have a requirement that ITIL users should be able to add new tasks to the existing RITMs for some specific catalog items. The RITM also has tasks which are generated through the workflow.
If we allow the ITIL users to add the tasks dynamically, the RITM closes if the tasks generated through the workflow are closed. (Manually added tasks are still open)
How can we prevent the RITM from closing until all the tasks (generated through workflow + manually added) are closed.
Thanks,
Madhura

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 06:59 AM
Hello MAdhura,
Please write On before Businesses rule on Ritm which will not allow anyone to close the ritm untill the task are not close.
In "When to run" tab of Business rule write condition
state changes to closed.
Pleasse check below image
Code will be
var gr=new GlideRecord('sc_task');//catalog task table name
gr.addQuery('request_item',current.number);//filtering record
gr.query();
while(gr.next())
{
if(gr.state!='3')//Please keep right state value of Task CLosed
current.setAbortAction(true);
}
Please Mark it helpful/correct if my answer helps in any way to resolve your query.
Reach out to me if any more help required.
Regards
Yash.K.Agrawal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 11:22 PM
Hello Madhura,
Did your query resolve from my answer.
If Yes then please mark my answer CORRECT and HELPFUL
If no ,Please keep posted so that I can help you.
Regards,
Yash Agrawal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 07:07 AM
Hi,
Write a before update BR on ritm and check like this
Conditions: state changes to closed complete
Script
var gr=new GlideRecord('sc_task');
gr.addEncodedQuery("request_item="+current.sys_id+"^state!=3");
gr.query();
if(gr.next())
{
current.setAbortAction(true);
}
Mark the comment as a correct answer and helpful if it helps to solve the problem.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 07:10 AM
Or you can check like this as well, where it checks for open and pending
gr.addEncodedQuery("request_item="+current.sys_id+"^state=1^ORstate=-5");