- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2017 08:15 AM
SN Team,
In the process of modifying an existing Cancel Change UI Action. The goal is for the new UI Action to provide an confirmation window before proceeding with the Cancel Change request.
I have reviewed the following articles and here is what I came up.
Reference 1:
https://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/
Reference 2: Re: Cancel confirm window after clicking cancel button
Main issue: Confirmation window opens fine and allows user to Cancel. Having trouble getting the Cancel Change request to execute when OK is selected.
Looking for some help figuring out how to get the moveToCancel(); function to execute.
//moveToCancel();
//confirmCancel();
function confirmCancel(){
var answer=confirm("Are you sure you want to cancel this record?");
if (answer==false)
{
// gsftSubmit(null, g_form.getFormElement(), 'cancel_change'); //MUST call the 'Action name' set in this UI Action
alert('This change was not cancelled');
return false;
}
else
{
moveToCancel();
return true;
}
}
function moveToCancel(){
action.setRedirectURL(current);
if (new ChangeRequestStateHandler(current).moveTo("canceled"))
current.update();
}
}
Thanks,
Jahanzeb
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2017 10:11 AM
- function confirmCancel(){
- var answer=confirm("Are you sure you want to cancel this record?");
- if (!answer)
- {
- alert('This change was not cancelled');
- return false;
- }
- else
- {
- gsftSubmit(null, g_form.getFormElement(), 'cancel_change'); //MUST call the 'Action name' set in this UI Action
- }
- }
- function moveToCancel(){
- action.setRedirectURL(current);
- if (new ChangeRequestStateHandler(current).moveTo("canceled"))
- current.update();
- }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2020 12:59 AM
that's correct
please share UI action screenshot
your function name should be same Cancelconfirm()
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2020 01:20 AM
function name is same as you mentioned but i can see that its not setting request to cancelled phase and and making it active false.