Cancel workflow script is not working in VA
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
I have created one topic for open RITMS and given actions for cancel RITM for cancel i have write the below script in VA but not working state and comments updating fine but stage and workflow cancel not working
script:
(function execute() {
var response = '';
var gr = new GlideRecordSecure(vaVars.table_name);
if (gr.get(vaVars.sys_id)) {
var comment=vaInputs.reason_for_request_cancel.getValue().trim()
if (comment) {
var workflow = new global.Workflow();
workflow.cancel(gr);
gr.approval = 'withdrawn';
gr.state = 4;
gr.stage= 'Request Cancelled';
gr.comments="Cancelled by with comment: " + comment;
gr.active = false;
gr.update();
if (vaVars.table_name == 'sc_req_item')
response = gs.getMessage("Requested item has been cancelled");
else {
response = gs.getMessage("OK, no comment will be added.");
}
} else
response = gs.getMessage("I couldn't find the record.");
}
return response;
})()
0 REPLIES 0