Pass params from UI Action to UI Page

Or Kalev2
Tera Contributor

Hi all,
I have a UI action that calls UI Page. 
I used the new GlideDialogWindows to render the UI Page as popup

 

function PopUIPage(){
	var sysIds = g_list.getChecked();
	var gdw = new GlideDialogWindow('ui_page');
	gdw.setSize(750,300);
	gdw.setPreference("sys_ids", sysIds);
	gdw.render();
}

 

 
Then I try to get the 'sys_ids' on the UI Page. 
Where I can get them? At the HTML? Client Script? I try every thing without any success. 
Thanks.  

1 ACCEPTED SOLUTION

AakashG2703
Mega Guru

Hi @Or Kalev2,

Hope you are doing well.

 

Proposed Solution

In order to achieve this task, I personally tried it on my "Personal Developer Instance" so that you can get the solution as soon as possible. For this, you just need to get all the "Sys IDs" in "HTML/XML Section" of your "UI Page" to get your query resolved. Attaching my Scripts and some snapshots of the outputs for your reference mentioned below: -

 

UI Action: -

function confirmAction() {
    var sysIds = g_list.getChecked();
    alert(sysIds);
    var dialog = new GlideDialogWindow('incident_details');
    dialog.setTitle('Incident Details');
    dialog.setSize(550, 200); // consists of Height and Width
    dialog.setPreference('sysparm_sysid', sysIds);
    dialog.render();
}

AakashG2703_1-1712579477194.png

 

UI Page: -

<?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 var="jvar_sysid" expression="RP.getWindowProperties().get('sysparm_sysid')" />
<p>${jvar_sysid}</p>
</j:jelly>

AakashG2703_0-1712579412705.png

 

Outputs: -

AakashG2703_3-1712579563207.png

AakashG2703_4-1712579590206.png

 

 

If you find this information/knowledge/solution helpful, please don't forget to mark my solution and reply as helpful and accepted.

 

Thanks ‌‌:)

Aakash Garg

ServiceNow Developer

View solution in original post

7 REPLIES 7

M Ismail
Tera Guru

Hi @Or Kalev2,

checkout this 
https://www.servicenow.com/community/developer-forum/how-to-pass-data-from-a-ui-action-to-a-ui-page/...

Please hit helpful and accept this as a solution if it solved your problem.
Thank you!

I saw the post, I got an error that g_scratchpad is not define

 

Check this UI Action and how they have defined the g_scratchpad variable and access that in UI Page 

MIsmail_0-1712566202001.png

Please hit helpful and accept this as a solution if it solved your problem.
Thank you!




The code of the UI Page should be at the Client Script part of the UI Action? 
Because I get an error. 

OrKalev2_0-1712567310546.png