- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2022 09:29 PM
Hi there,
I created a UI page that displays Yes/No button. Based on the user input selection the actions gonna take place. But the user is still able to close the UI page using the "cross mark" without selecting any input. That should not happen.
Please help me in removing that "cross mark" and also I want to place this UI popup at the top of page instead of center.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2022 10:09 PM
Hi,
You can use this code and it would show the confirm box with Yes/No and it comes in center
var dialog = new GlideModal('glide_modal_confirm', true, 300);
dialog.setTitle('Confirmation');
dialog.setPreference('body', 'Is there a Cost impact?');
dialog.setPreference('focusTrap', true);
dialog.setPreference('onPromptComplete', doComplete);
dialog.setPreference('onPromptCancel', doCancel);
dialog.render();
function doComplete() {
callback(true);
}
function doCancel() {
callback(false);
}
Output:
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2022 10:09 PM
Hi,
You can use this code and it would show the confirm box with Yes/No and it comes in center
var dialog = new GlideModal('glide_modal_confirm', true, 300);
dialog.setTitle('Confirmation');
dialog.setPreference('body', 'Is there a Cost impact?');
dialog.setPreference('focusTrap', true);
dialog.setPreference('onPromptComplete', doComplete);
dialog.setPreference('onPromptCancel', doCancel);
dialog.render();
function doComplete() {
callback(true);
}
function doCancel() {
callback(false);
}
Output:
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2022 10:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2022 10:28 PM
Hi,
are you using script I shared?
what input you want?
The script already has the callback method what will happen when yes is clicked; what will happen when no is clicked
var dialog = new GlideModal('glide_modal_confirm', true, 300);
dialog.setTitle('Confirmation');
dialog.setPreference('body', 'Is there a Cost impact?');
dialog.setPreference('focusTrap', true);
dialog.setPreference('onPromptComplete', doComplete);
dialog.setPreference('onPromptCancel', doCancel);
dialog.render();
function doComplete() {
// when user clicks Yes
callback(true);
}
function doCancel() {
// when user clicks No
callback(false);
}
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2022 10:32 PM
As you see in the above screen shot, I added the below line when user clicks Yes. But its not making the value true.
"g_form.setValue('u_cost_impact',true);"
It worked after commenting the callback line. So, the GlideModal glide_modal_confirm" you are calling , is this an OOB ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2022 10:34 PM
It worked after commenting the callback line.