How to call an UI page from UI Action in Service Now ?

Priya Singh 2 2
Tera Contributor

Hi Team,

Thank you in advance!

I have got one requirement to create an UI action and by clicking on that UI action one UI page should appear with 20 user details (like - name, email, phone, company) and these details are coming from a 3rd party as we have integration, how we can fulfill this requirement/what all code would be required, could you please explain in detail.

4 REPLIES 4

Anurag Tripathi
Mega Patron
Mega Patron

Here is how to render a ui page

var gdw = new GlideDialogWindow('<ui Page name>');
	gdw.setSize(750,300);
	gdw.setPreference('<parameter to pass>', <value>);
	gdw.render();

 

What you do on the page is quite vast, i would suggest start creating it and ask here for specific questions.

-Anurag

Thank You for your reply,

Below is my UI Page code:

 

<?xml version="1.0" encoding="utf-8" ?>

<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

    <g:evaluate jelly="true">

        var gr = new GlideRecord('sys_user');

        gr.addEncodedQuery('nameINWayne Johnson,Carl  Naylor,Reece David');

        gr.query();    

    </g:evaluate>

    <table border="p">

 

 

        <tr>

            <td><b>Engineer Name</b> </td>

            <td><b>Contact Number</b></td>

            <td><b>Email</b> </td>

           

        </tr>

    <g:for_each_record file="${gr}">

        <tr>

            <td>${gr.getValue("name")}</td>

            <td>${gr.getValue("mobile_phone")}</td>

            <td>${gr.getValue("email")}</td>

        </tr>

    </g:for_each_record>

    </table>

</j:jelly>

When I am clicking on Try it on UI page it is giving me Name, email, number of selected users in tabular form, however I want these information to be called on a custom table when I click on UI Action or UI Macros.

 

UI Macros Script: Same script which is written in UI page I am using in Macros, however I am not sure how can I call it so that UI page information should appear when I click on UI Macros.

UI action option is also fine, but not sure about the code.

Please assist

Robbie
Kilo Patron
Kilo Patron

Hi @Priya Singh 2 2,

 

Here's a great page from David McDonald who runs through setting up a pop-up (UI Page) via the GlideModal API.

Please note the use of GlideModal and not GlideDialog. (Glide Dialog - Client is not supported from San Diego onward)

 

https://davidmac.pro/posts/2022-02-08-glidemodal/

 

The script code to answer you question specifically:

// new GlideModal(

//    UI page name,

//    Hide the 'close' button,

//    width in pixels

// );

var gm = new GlideModal('ui_page_name', false, 400);

 

// Setup the modal window

gm.setTitle('The title at the top of the window');

gm.setPreference('somePreference', 'task');

gm.setPreference('anotherPreference', 'value');

 

// Show the dialog

gm.render();

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.

 

Thanks, Robbie

Robbie
Kilo Patron
Kilo Patron

Hi @Priya Singh 2 2,

 

Did you see my response below? Check out the sample code and linkI provided and please note the use of GlideModel class.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.

 

Thanks, Robbie