Change - Update Cancel Change Button

ServiceNow Use6
Tera Guru

Hi,

I have a requirement. Kindly help.

Cancelling a change requires users to have all tasks closed before the change can cancel. This creates a ton of extra work on the requestor to track these down manually and have other users close them. Add a condition to the cancel button that will cancel all tasks, in addition to approvals and the change itself. Cancel change button should cancel everything.

Regards

Suman P.

1 ACCEPTED SOLUTION

Musab Rasheed
Kilo Patron

Hello,

Just check if cancelling workflow will do all the things ?

var w = new Workflow();
var gr = new GlideRecord(‘wf_context’);

if (gr.get(current.context))
w.cancelContext(gr);
}
}

Regards

View solution in original post

5 REPLIES 5

Musab Rasheed
Kilo Patron

Hello,

Just check if cancelling workflow will do all the things ?

var w = new Workflow();
var gr = new GlideRecord(‘wf_context’);

if (gr.get(current.context))
w.cancelContext(gr);
}
}

Regards

Hi Masaab,

We are doing the flow designer and not workflow, does it work?

Regards

Suman P.

Not sure about flow designer but Check this out

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0959612

Regards

SumanthDosapati
Mega Sage

Hi,

You can try cancelling workflow as mentioned by @Musab Rasheed 

or else try this script in cancel ui action

var ct = new GlideRecord('change_task');
ct.addQuery('change_request', current.sys_id);
ct.query();
while(ct.next())
{
ct.state = '4'; //check cancelled value
ct.update();
}
current.state = '4'; //check cancelled value 
current.update();

 

Regards,
Sumanth