Sync the catalog task, Request and RITM requested for in all scenarios

Surendra6
Tera Contributor

Hi All,

 

I got a requirement to update the requested for field in all tables if it is updated any one of the request table. for example if we updated the requested for as ABC in RITM table the same will be updated automatically in Request and SC table table.

 

Please let me know how can we proceed this requirement.

 

Thanks!!

1 REPLY 1

AnveshKumar M
Tera Sage
Tera Sage

Hi @Surendra6

You can write a After Insert/Update business rule on sc_request and sc_req_item tables with the following scripts.

 

SC Request BR Script:

 

(function executeRule(current, previous /*null when async*/) {
var ritmGr = new GlideRecord("sc_req_item");
ritmGr.addQuery("request", current.sys_id);
ritmGr.query();
while(ritmGr.next()){
ritmGr.setValue("requested_for", current.requested_for);
ritmGr.update();
}

})(current, previous);

 

SC_REQ_ITEM BR Script:

 

(function executeRule(current, previous /*null when async*/) {
var reqGr = new GlideRecord("sc_request");
reqGr.addQuery("sys_id", current.request);
reqGr.query();
if(reqGr.next()){
reqGr.setValue("requested_for", current.requested_for);
reqGr.update();
}
})(current, previous);

 

Most importantly both BR should have the condition REQUESTED FOR::: CHANGES

 

IMG_20230819_072728.jpg

Thanks,
Anvesh