- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2016 01:59 PM
I am working on a Catalog Item that runs in the Request workflow. This item does not generate any task. The Request workflow will only request an approval and if approved, it will send an email to certain people. I added a set value that will put the Stage as Closed Complete and the State as Closed Complete but this is still keeping the RITM active and in a Stage of "Nothing".
Again, this is not running on any Requested item workflow, only on a request workflow.
Do you have any suggestion on how to make this work?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2016 05:22 PM
Hi Yonanthan,
If there is no BR or RITM workflow controlling the stage for the RITM, then you may need to set it as well in the same script:
while(gr.next()){
gr.state = 3; // State value for "Closed Complete"
gr.stage = (whatever end-stage value you have);
gr.update();
}
Generally though, 'stage' is used in workflows. If you don't have a RITM workflow, this is probably why it is not updated and you will have to update it manually as in the script above.
-Brian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2016 02:14 PM
Sure. Glad to have helped.
-Brian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2018 07:19 PM
Hi Brian,
I am trying to work on a similar request where I am need to set the workflow stage to completed in 'cancel request' UI action. The UI action successfully closes the item, but the workflow stage does not move.
I wonder if you could assist troubleshooting the issue.
My script is here:
function cancelRequest(){
if(confirm('Are you sure you want to cancel this request?')) {
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'cancel_request');
}
return false;
}
if (typeof window == 'undefined')
updateTaskAndRITM();
function updateTaskAndRITM(){
current.state = 3; //value for Closed complete
current.work_notes = 'Request Cancelled';
current.comments = 'This request been cancelled';
current.update();
var reqItem = new GlideRecord('sc_req_item');
reqItem.get(current.sys_id);
var gr = new GlideRecord("sc_req_item");
gr.addQuery("stage","executing");
gr.query();
while(gr.next()){
gr.state = 3;
gr.stage = "Complete";
gr.update();
}
new UIActionUtils().approvalsNoLongerRequired(current.sys_id);
}
Many thanks,
Anna