- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2025 05:39 AM
Hello guys,
we tried to implement a new modal on one of our Ui action triggered by a button on the change_task table.
Unfortunetly we got an error in the logs:
com.glide.script.RhinoEcmaError: “GlideModal“ is not defined
we have checked the « client » checkbox on our Ui action.
we have unchecked the « isolate script » checkbox on our Ui action.
Here is the code used to create our modal in the ui action, as you will see, we almost made a copy/paste of the official documentation:
var dialog;
var dialogClass = window.GlideModal ? GlideModal :GlideDialogWindow;
dialog = newdialogClass('change_exception_gel_modal');
//Set the dialog title
dialog.setTitle('TEST');
dialog.setPreference('onPromptComplete', doComplete);
dialog.setPreference('onPromptCancel', doCancel);
//Opens the dialog
dialog.render();
Thanks in advance for your help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2025 04:04 AM
Hello everyone,
I figured out what was the issue there.
In UI action depending on where your lines are in the script field it will either run on client side or in server side.
I forgot about it and I was trying to call the dialog class on the server side part of my script.
Solution: check that you are in the good part of your script, if you want to call class or object from ClientAPI be sure that your definitions or calls are made in the scope of the function defined in the field "Onclick" of your UI Action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2025 05:45 AM
dialog = new dialogClass('change_exception_gel_modal');
Edit this line in this line there should be space between new and dialogclass
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Uday Rathore
ServiceNow Developer
LinkedIn: https://www.linkedin.com/in/uday-rathore049/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2025 04:06 AM
Hello @Udayrathore049 ,
Thanks for the reply but this is just an error due to the copy/paste on the text editor here, the problem was not from that and I explain it in the solution I provided below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2025 05:56 AM
Hi @theo moreto
Try the following and see how it goes. Also, make sure that doComplete and doCancel have values.
var dialog= new GlideModal ('change_exception_gel_modal');
//Set the dialog title
dialog.setTitle('TEST');
dialog.setPreference('onPromptComplete', doComplete);
dialog.setPreference('onPromptCancel', doCancel);
dialog.render();
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2025 04:07 AM - edited 05-09-2025 04:07 AM
Hello @J Siva ,
Thanks for the reply and for the advice, the problem was not there and I explain it in the solution provided below.