- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 12:02 AM - edited 07-30-2025 12:06 AM
Hi Ankur, Kindly help me with this code. My requirement is to have Yes/No buttons. Upon No response, it has to open external URL. I have made changes in your code as below. Though it is working fine for me I just wanted to check with you whether it has any performance impact. Thought it is opening url in new tab but the dialog box remains in the page. how to disappear dialog box when I click on NO?
Below is my OnChange client script

When I click NO the above dialog box should disappear like how it disappears if we click on Yes.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 12:31 AM
I believe since we are using the OOTB glide_modal_confirm, we can't change the position.
try this updated code and anyhow you need to close modal if it's Yes/No
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var dialog = new GlideModal('glide_modal_confirm', true, 300);
dialog.setTitle('Apps Assist Check Point');
dialog.setPreference('body', 'Did you check Apps Assist?');
dialog.setPreference('focusTrap', true);
dialog.setPreference('onPromptCancel', doCancel);
dialog.setPreference('onPromptComplete', doComplete);
dialog.render();
function doComplete() {
// YES button clicked
dialog.destroy();
// Your logic for Yes goes here.
}
function doCancel() {
// NO button clicked
dialog.destroy();
top.window.open("https://mywebsite.com/", "_blank");
g_form.setValue('state', oldValue);
}
}
it worked for me, Output below
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
07-30-2025 12:31 AM
I believe since we are using the OOTB glide_modal_confirm, we can't change the position.
try this updated code and anyhow you need to close modal if it's Yes/No
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var dialog = new GlideModal('glide_modal_confirm', true, 300);
dialog.setTitle('Apps Assist Check Point');
dialog.setPreference('body', 'Did you check Apps Assist?');
dialog.setPreference('focusTrap', true);
dialog.setPreference('onPromptCancel', doCancel);
dialog.setPreference('onPromptComplete', doComplete);
dialog.render();
function doComplete() {
// YES button clicked
dialog.destroy();
// Your logic for Yes goes here.
}
function doCancel() {
// NO button clicked
dialog.destroy();
top.window.open("https://mywebsite.com/", "_blank");
g_form.setValue('state', oldValue);
}
}
it worked for me, Output below
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
07-30-2025 12:45 AM
Hi Ankur,
Thank you so much for the quick response.
Dialog box is still staying on the page for No response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 01:10 AM - edited 07-30-2025 01:11 AM
it worked for me if you check the above gif.
On click of No you are setting field value, you don't want to save that?
Any browser console error you are getting when No is clicked?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 01:25 AM
No . I don't want to save when I click No.
No browser console errors but I see warnings as below