UI action to cancel workflow and close complete RITM and not spawn any followed tasks

Sam198
Mega Guru

Hi all,

I have this UI action button where it should close the current sctask and ritm and it should cancel the workflow so that it does not spawn the follow up sctask (as there is one in the workflow). The closure of current sctask and ritm is working however, the following sctask/workflow is not cancelling:

UI action table: sc_task

script:

function cancelTask(){

if(confirm('Are you sure you want to close complete this request?')){
gsftSubmit(null, g_form.getFormElement(), 'cancel_sc_task');
return true;

}
return false;
}

// Server side code
if(typeof window == 'undefined')
updateTaskAndRITM();
function updateTaskAndRITM(){
new Workflow().deleteWorkflow(current);
current.active=false;
current.state=3;
current.update();
action.setRedirectURL(current);

var reqItem = new GlideRecord('sc_req_item');
new Workflow().deleteWorkflow(current);
reqItem.get(current.request_item);
reqItem.state = 3; //value for Closed complete
reqItem.stage = 'Completed';
reqItem.update();

new UIActionUtils().approvalsNoLongerRequired(current.sys_id);


}

 

This circled sctask still spawns that should not have spawned:

 

find_real_file.png

1 ACCEPTED SOLUTION
5 REPLIES 5