Glide modal undefined on UI action

theo moreto
Tera Expert

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.

1 ACCEPTED SOLUTION

theo moreto
Tera Expert

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.

View solution in original post

5 REPLIES 5

Udayrathore049
Tera Contributor

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/

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.

J Siva
Tera Sage

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

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.