We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Pending state on the task form should cascade to the parents (RITM and Request)

Christian22A
Tera Contributor

When the state of a Catalog Task is changed to pending the RITM and Request state should also change to reflect the task.  How is this completed with a Business Rule?

1 ACCEPTED SOLUTION

Not applicable

Hi @Christian22A 

 

Create an after business rule in sc_task table and use GlideRecord on RITM table and REQ table. You can use RITM reference field to filter the GlideRecord query.

 

Example:

 

var ritm = new GlideRecord(‘sc_req_item’);

ritm.addQuery(‘sys_id’ , current.request_item);

ritm.query();

if(ritm.next()){
ritm.state= current.state;

ritm.update();

}

 

var req = new GlideRecord(‘sc_request’);

req.addQuery(‘sys_id’ , current.request_item.request);

req.query();

if(req.next()){
req.state= current.state;

req.update();

}

 

if current.request_item will not work then use current.parent. 

Add Condition in your BR that state changes to pending

 

Thank you!

 

Please mark this response as correct and helpful if it works ✔️👍

View solution in original post

1 REPLY 1

Not applicable

Hi @Christian22A 

 

Create an after business rule in sc_task table and use GlideRecord on RITM table and REQ table. You can use RITM reference field to filter the GlideRecord query.

 

Example:

 

var ritm = new GlideRecord(‘sc_req_item’);

ritm.addQuery(‘sys_id’ , current.request_item);

ritm.query();

if(ritm.next()){
ritm.state= current.state;

ritm.update();

}

 

var req = new GlideRecord(‘sc_request’);

req.addQuery(‘sys_id’ , current.request_item.request);

req.query();

if(req.next()){
req.state= current.state;

req.update();

}

 

if current.request_item will not work then use current.parent. 

Add Condition in your BR that state changes to pending

 

Thank you!

 

Please mark this response as correct and helpful if it works ✔️👍