RITM and Request must be same as Catalog Task state, When state changes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2022 11:23 PM
Hi All,
I want to keep RITM and Request states same as Catalog Task(SC TASK) state for particular catalog task's when state changes.
ex: If Catalog Task state changes to 'working in progress' then RITM and Request state also should be same in 'Working in progess'.
Please help me.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2022 11:27 PM
Hi Abdul,
Create After Update BR on sc_task table where condition is state changes to 'Work in Progress' and write below code
(function executeRule(current, previous /*null when async*/ ) {
var getritm=new GlideRecord('sc_req_item');
getritm.addQuery('sys_id',current.request_item);
getritm.query();
if(getritm.next())
{
getritm.state=current.state;
getritm.update();
}
var getreq=new GlideRecord('sc_request');
getreq.addQuery('sys_id',current.request);
getreq.query();
if(getreq.next())
{
getreq.state=current.state;
getreq.update();
}
})(current, previous);
Kindly mark correct and helpful if applicable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2022 12:37 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2022 11:29 PM
Hey,
Few precautions here, make sure state transition doesn't happen on workflow level:
Write up a Insert/Update After Business rule, and condition as State changes on Catalog task table, use belwo script:
var requestedItem = current.request_item.getRefRecord();
requestedItem.setValue("state", current.setValue("state"));
requestedItem.update();
var request = current.request_item.request.getRefRecord();
request.setValue("state", current.setValue("state"));
request.update();
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2022 04:25 AM
Hi Aman,
I tried with your script. no, it is not working for me.