How to call a ui page inside a Catalog client script

Community Alums
Not applicable

Hi,

I created a ui page with html and client script.

Then i created a catalog client script and im using this script to call the ui page, but im getting a Java Script Error, i also tried with new GlideDialogWindow but i got the same Error

var gm = new GlideModal('pop_up_yes_no');
gm.setTitle('My Custom UI Page');
gm.setSize(600, 300); // Optional: width, height
gm.render();

 

2 REPLIES 2

lauri457
Giga Sage

Are you trying this in service portal? For sp you want to use the spmodal class.
spModal | ServiceNow Developers

prajaktajga
Tera Expert

Hello @Community Alums ,

1.GlideModal does NOT work in Catalog Client Scripts

2.UI Pages do NOT render inside Service Portal unless wrapped in a Widget

This is why you're getting a JavaScript error, even though the script is correct syntactically.

If your catalog item is running in Service Portal. You cannot open a UI Page with GlideModal.

Instead, you must use:

SPModal

Example:

spModal.open({
title: "My Title",
message: "This is a modal from Service Portal."
}).then(function(answer){
console.log("User clicked:", answer);
});