Ui page from OnSubmit client script not working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 07:07 AM
Hi Team,
We have created a UI page and that display when submitting the Catalog item. We have write script for the same, but, the after submitting the catalog item, UI page appears and If I click on OK the UI page button, UI page is disappear and catalog item stays on the same form. Please let me know where exactly modify the script.
UI page client scrpt:
function cancel(){
GlideDialogWindow.get().destroy(); //Close the dialog window
return false;
}
function submit(){
GlideDialogWindow.get().destroy();
return true;
}
Catalog item onSubmit script:
function onSubmit() {
//show modal dialog
var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
var dialog = new dialogClass("Acknowledgement");
dialog.setTitle("Acknowledgement");
dialog.setWidth(600);
dialog.render();
return false;
}
Thanks & Regards,
Prasanna Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 07:26 AM
I see that in the UI Page client script, submit function has the below line of code
GlideDialogWindow.get().destroy();
because of this it is disappearing.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 08:11 AM
@Community Alums Yes GlideDialogWindow.get().destroy(); is for disappearing the UI page. That means, once you click on ok then the UI page should disappear and the Catalog item should submit. Here my issue is UI page is disappearing, but catalog item stay on previous page only, it is not submitting.
Thanks & Regards,
Prasanna Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 08:35 PM - edited 02-23-2023 08:36 PM
The problem is that your client script is returning false, which prevents submission. You'll need a two-step script to resolve this.
I've written an article with detailed instructions on exactly how to solve this issue, as it's very common for any asynchronous logic that needs to happen in onSubmit client scripts in ServiceNow. You can find that article at https://onsubmit.snc.guru - this is the solution to your issue. 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 06:06 AM - edited 02-27-2023 08:51 AM
@Tim Woodruff Thank you for you response. But, how would I include UI page in this script? can you help on to include UI page in your script.
Catalog item onSubmit script:
function onSubmit() {
//show modal dialog
var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
var dialog = new dialogClass("Acknowledgement");
dialog.setTitle("Acknowledgement");
dialog.setWidth(600);
dialog.render();
return false;
}
Thanks & Regards,
Prasanna Kumar