- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 10:55 AM
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 11:12 AM
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 ✔️👍
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 11:12 AM
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 ✔️👍