Can you pass parameters to a UI page in an application scope from a Client Script the Global Scope?

isqc
Tera Expert

Hi

 

We currently have one Client Script in the Global Scope (because it is defined against the sys_update_xml table), which creates a UI page, also in the global scope, and sets a few parameters. That works fine.

 

We are trying to move the UI Page into our application scope. We can open the UI page in our application scope from Global, by prefixing the name of the UI Page with our application scope prefix, separated by '_'. That is also working fine. 

 

The problem is that none of the parameters which we are setting in the page in the client script in the Global scope can be retrieved from the UI page when it loads. We create the UI Page like this, in the Client Script in the Global Scope.

 

var gm = new GlideModal("x_app_scope_ui_page_name", true);

//Sets the dialog title - This works fine, the title is set in the page when it loads
gm.setTitle('Window Title ' + g_form.getValue('name') + '.');

//These two parameters are not available in the UI Page!
gm.setPreference('param1', g_form.getValue('name'));
gm.setPreference('param2', g_form.getUniqueValue());

 And we retrieve them in the UI Page like this:

 

In the HTML content of the page

 

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

<g:evaluate var="jvar_param1"
expression="RP.getWindowProperties().get('param1')" />
<g:evaluate var="jvar_param2"
expression="RP.getWindowProperties().get('param2')" />

 And in the Client Script of the UI Page:

 

addLoadEvent(loadMe);
function loadMe()
{
// The two variables below are always NULL
var param1Value = gel('jvar_param1').value;
var param12alue = gel('jvar_param2').value;

 Note that the code of the UI page is an exact copy of the code which works fine in the Global scope. The only change we made is changing the name of the UI Page to load the one in our application scope.

 

Is there a special syntax that needs to be used when crossing scopes from Global to the application scope? Or maybe this is restricted and needs to be enabled via some configuration? Or maybe it's just not allowed?

 

Thanks in advance for any help

 

Ignacio

1 ACCEPTED SOLUTION

Saikiran Guduri
ServiceNow Employee
ServiceNow Employee

Use below HTML and try again

 

 

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

<g:evaluate var="jvar_param1"
expression="RP.getWindowProperties().param1.toString()" />
<g:evaluate var="jvar_param2"
expression="RP.getWindowProperties().param2.toString()" />

 

View solution in original post

3 REPLIES 3

Saikiran Guduri
ServiceNow Employee
ServiceNow Employee

Use below HTML and try again

 

 

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

<g:evaluate var="jvar_param1"
expression="RP.getWindowProperties().param1.toString()" />
<g:evaluate var="jvar_param2"
expression="RP.getWindowProperties().param2.toString()" />

 

Great it works for me!!!

isqc
Tera Expert

Great, that works just fine!

 

Thanks a lot for the quick reply.

 

Ignacio