Sync the catalog task, Request and RITM requested for in all scenarios
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2023 01:40 PM
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!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2023 06:34 PM - edited 08-18-2023 06:58 PM
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
Anvesh