- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2022 10:57 AM
Hi,
I have a requirement where the state of the RITM should be the same as the SCTask. When the SCTask is set to Closed incomplete, the RITM should show state as Closed Incomplete, if the SCTask is set to Closed Skipped, the RITM should show state as Closed Skipped, SCTask is set to Closed Complete, the RITM should show state as Closed Complete.
I have tried the workflow route and business rules route but nothing seems to be working.
Any help would be appreciated.
Thanks,
Mallika
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2022 11:37 AM
Line number 10 is incorrect in your script. Please use the exact version of script as shared above. You don't need to hard code any sys id there.
Please use the exact script with no change required here.
Sharing it again for reference below:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if(current.state.changes()){
updateRITMState(current.request_item,current.state);
}
function updateRITMState(RitmID,state){
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id',RitmID);
gr.query();
if(gr.next()){
gr.state = state;
gr.update();
}
}
})(current, previous);
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2022 11:08 AM
Hello
After the catalog task workflow just write a if logic check the state of task and based in that have rwo set values attribute it will then move it to the one which we require
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2022 11:13 AM
Hi
Please follow the steps below to achieve your requirement:
BR:
Table : Catalog Task
After Update
Condition of BR: State Changes;
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if(current.state.changes()){
updateRITMState(current.request_item,current.state);
}
function updateRITMState(RitmID,state){
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id',RitmID);
gr.query();
if(gr.next()){
gr.state = state;
gr.update();
}
}
})(current, previous);
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2022 11:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2022 11:37 AM
Line number 10 is incorrect in your script. Please use the exact version of script as shared above. You don't need to hard code any sys id there.
Please use the exact script with no change required here.
Sharing it again for reference below:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if(current.state.changes()){
updateRITMState(current.request_item,current.state);
}
function updateRITMState(RitmID,state){
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id',RitmID);
gr.query();
if(gr.next()){
gr.state = state;
gr.update();
}
}
})(current, previous);
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke