- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 02:16 AM
Hello all,
On the Incident form, when the user is trying to save the form after the state has been moved to Resolved, then I need to display an alert with Yes or No, instead of Ok and Cancel using confirm("Validated with user?");
So, can someone let me know how can we do this?
Regards,
Lucky
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 02:37 AM - edited 05-13-2025 02:40 AM
business rule can't show you dialog box as dialog box only works from client side code
I suggested to use that dialog box code in the Close button
Did you try that approach?
Don't create any client script
function moveToClosed() {
var dialog = new GlideModal('glide_modal_confirm', true, 300);
dialog.setTitle('Confirmation');
dialog.setPreference('body', 'Validated with user?');
dialog.setPreference('focusTrap', true);
dialog.setPreference('onPromptComplete', doComplete);
dialog.setPreference('onPromptCancel', doCancel);
dialog.render();
function doComplete() {
callback(true);
g_form.setValue("state", "3");
gsftSubmit(null, g_form.getFormElement(), "state_model_move_to_closed");
}
function doCancel() {
callback(false);
return false;
}
}
if (typeof window == 'undefined')
setRedirect();
function setRedirect() {
current.update();
action.setRedirectURL(current);
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 03:53 AM
We cannot do that from business rule. You can do it in UI Action for "Close" button instead.
You can use the code suggested by @Ankur Bawiskar for that.
Feel free to reach out for any further help.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 04:46 AM
Hello SUmanth and Ankur,
Yes, I can go ahead with updating "Close" UI action. But here we have an existing scenario also, like after selecting Close code as successful in Implement state and right cick on the form and save it, then it will go to close state.
So, here as we write the logic in "CLose" UI action, it will fail here right?
SO, I am not understanding how to convince all the times
Regards,
Lucky
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 05:14 AM
then you can use onSubmit for that case and show the pop-up. check in onSubmit what's the state? if it's close then show popup
this covers your above case where they select close code and right click -> save
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 05:43 AM
Along with UI action script, you can write an onSubmit client script and use the glideDialogClass code which we shared in earlier replies.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 09:04 AM
Hello Sumanth,
How can I write the on Submit CS once the Change request is closed from the workflow?
Can you please provide me the code?
Also, I have used Confirm ("Are you Sure?"); in on Change client script, and inside the logic,
if(newValue == '3') //3 is closed{
alert("New value is "+newValue);
confirm("Are you sure you want to close?");
}
but here, the alert message itself is not coming and the CR is getting closed as it follows the workflow.
Regards,
Lucky