- 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 12:05 AM
Hello ANkur and SUmanth,
I tried both of your logics but I am not getting any Dialog box with Yes or No.
Scenario I am using.
I have created an On Change Client script on State field of Change Request form,
So, when the state moves to CAB review, it has to show that dialog box,
Currently, I am getting alert message but the next lines of code not executing.
Please help.
This is my Code:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 12:19 AM
I exactly copy pasted the same script which you gave (just by removing if loop for testing) and it worked for me.
See below screenshot
Can you try creating a new client script and check if it is working without any if condition first.
Accept the solution and mark as helpful if it does, to benefit future readers.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 01:44 AM - edited 05-13-2025 01:49 AM
Ok Sumanth.
But can you try this for Change request and on change of state to Implement.
Because if we manually change the state, then this dialog box will come, if the system is changing the state like on Change Request, this is not working.
Regards,
Lucky

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 02:17 AM
What do you mean by system is changing? When you click on some UI action? Or server side change? or client side change based on another field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 02:23 AM
Hi Sumanth,
Let me tell you clearly.
On the Change Request form, whenever the state is moving to Closed, then this dialog box has to be shown with Are you sure you want the CR to be closed? Yes / No,
If the user selects No, then the CR has to go back and update the state to Review.
Else, it should get closed, if the user clicks on Yes.
So, here I mean Whenever, we click on Close UI action button on the Change request form. the CR State will move to closed, So, before this closure, I want to show this dialog box with Yes or No options. Selecting No, will not take the CR to move forward and close.
Regards,
Lucky