Trying to Change RITM Stage value based on Catalog Task State
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2022 08:46 AM
Hi,
I have a requirement say for example when Catalog Task - State moved to "Pending" then RITM - Stage should be "Pending". Based on RITM "Pending" Stage I wanted to pause the Resolution SLA for this Catalog item.
I tried a Business Rule to change the Stage however it is not working as expected. Please find the script below I am using in Business rule.
Script under Advanced tab:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
gs.addInfoMessage("current.state"+current.state);
var gr = current.request_item.getRefRecord();
if(current.state == -5){
gr.stage ='Pending';
}
else{
gr.stage ="fulfillment";
}
gr.update();
gs.addInfoMessage("the set stage is "+gr.stage);
})(current, previous);
What I am doing wrong here, it would be great if anyone can assist.
regards,
Raghesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2022 08:53 AM
//Did you want to set stage or state ?
//State can be set via BR, if its stage its a good practice that it comes from either flow or workflow.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
gs.addInfoMessage("current.state"+current.state);
var gr = new GlideRecord('sc_req_item');
gr.get(current.request_item.sys_id);
//var gr = current.request_item.getRefRecord();
if(current.state == -5){
gr.stage ='Pending';
}
else{
gr.stage ="fulfillment";
}
gr.update();
gs.addInfoMessage("the set stage is "+gr.stage);
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2022 09:07 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2022 09:00 AM
Do you have a stage of pending? The out of the box stages do not include pending.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2022 09:08 AM