- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2014 08:31 PM
Hi SN folks,
What can I use to configure a confirm pop up - when clicking cancel button on the change form. If user press cancel - It will ask confirmation, if press OK - cancel change- if cancel It must return to change form without cancelling the record.
Thanks for your help.
Solved! Go to Solution.
- Labels:
-
Service Mapping
- 56,366 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2014 08:50 PM
attachment seems not be working for me ....
this is the code ...
Note : check the 'client' checkbox and in 'onlick' field , paste this cancelTicket();
function cancelTicket(){
var answer=confirm("Are you sure you want to cancel this record?");
if (answer==true)
{
gsftSubmit(null, g_form.getFormElement(), 'cancel_change'); //MUST call the 'Action name' set in this UI Action
}
else
{
return false;
}
}
if(typeof window == 'undefined')
{
current.state = 8;
current.update();
action.setRedirectURL(current);
gs.addInfoMessage('The current change request has been cancelled.');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2014 09:01 PM
this should help
var answer=confirm("some message");
if (answer== true)
{
//your script to ok should come here
}
else
{
return false; //stops the submission of form
}
mark the question as answered if it helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2014 11:39 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2014 01:47 PM
Hi Jesus,
confirm box can be used only in client side scripting. To use Kalaiasaran's code, you need to check the client checkbox on your UI Action.
Go through this Guru post that explains how to use client side and server side code in an UI Action.
http://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/
Hope that helps.
Mandar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2014 07:29 PM
Mandar, Thanks a lot. It works now. However when the condition is true. It is not cancelling the change. It is popping up the confirmation though.
function runClientCode(){
var answer=confirm("Are you sure you want to cancel this record?");
if (answer==true)
{
current.state = 8;
current.update();
action.setRedirectURL(current);
gs.addInfoMessage('The current change request has been cancelled.');
}
else
{
return false;
}
}