Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Pass Data from UI action to UI page.

kuttti
Kilo Guru

Hi Community,

 How would I pass data through my UI Action to my UI Page, and then send that info to my Script Include to update selected Records? I've updated the post with my code. I have deadline on this can you please help. I am referring to following community article but I am not able to figure it out.

https://community.servicenow.com/community?id=community_question&sys_id=bee42a44db4ba0506621d9d9689619e9

1 REPLY 1

AnirudhKumar
Mega Sage

The key is to use GlideDialogWindow.

function call_UI_Page()
{
var gDialog1 = new GlideDialogWindow('ui_page_name');
gDialog1.setTitle('Put your title here');
gDialog1.setSize(700,700);
gDialog1.setPreference('your_parameter_name', 'your_parameter_value');//Passing a parameter
gDialog1.render();
}

 

And then in your UI page we will have to 'catch' the parameter and store it in a jelly variable.

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<html>
                      <!--Catching the parameter and storing it in a jelly variable called jvar_sys_id-->
                       <j:set var="jvar_sys_id" value="${RP.getWindowProperties().get('your_parameter_name')}"/>   

                        <!--Storing it in a hidden input html field with id = record_sys_id-->
                        <input id="record_sys_id" type="hidden" value="${jvar_sys_id}" />
</html>

</j:jelly>

 

Now we catch the value in a javascript variable in client script.

var sys_id = $j('#record_sys_id').val();
alert(sys_id);

 

After then comes your glideajax...