
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2017 01:44 AM
Hi,
a UI action should cancel a workflow ... as well as all approvals.
Somehow the cancelation of the approvels went fine .. but the "old" workflow is still active and goes ahead when restating the process.
Could you please check what is wrong here?
****
function clickedCancel(){
if(confirm('SURE?')){ //Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'cancel_xxx'); //MUST call the 'Action name' set in this UI Action
}
return false;
}
// Server side code
if(typeof window == 'undefined')
cancelXXX();
function cancelXXX(){
current.u_field= '123';
current.update();
gs.addInfoMessage(gs.getMessage("Message"));
// cancel approval workflows
var wf = new Workflow();
wf.cancel(current);
new WorkflowApprovalUtils().cancelAll(current);
new Workflow().restartWorkflow(current);
//cancel workflow
var oldWorkflow = new Workflow();
oldWorkflow.cancel(current);
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2017 01:48 AM
Refer the below thread may helpful to you.
ServiceNow Commnunity MVP -2018 class.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2017 01:48 AM
Refer the below thread may helpful to you.
ServiceNow Commnunity MVP -2018 class.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2017 02:02 AM
YES! Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2017 02:04 AM
Like this all works fine ...
function clickedCancel(){
if(confirm('SURE?')){ //Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'cancel_xxx); //MUST call the 'Action name' set in this UI Action
}
return false;
}
// Server side code
if(typeof window == 'undefined')
cancelXXX();
function cancelService(){
// delete workflow
new Workflow().deleteWorkflow(current);
current.u_field= '123';
current.update();
gs.addInfoMessage(gs.getMessage("Message"));
// cancel approval workflows
var wf = new Workflow();
wf.cancel(current);
new WorkflowApprovalUtils().cancelAll(current);
new Workflow().restartWorkflow(current);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2017 04:33 AM
Still strange ... when restarting the WF after the Workflow was changed ... the "old version" is taken ...