UI Page not rendering when passing parameters from UI action

ray evans
Tera Guru

Hi

 

I have a UI action (client with Onclick) on Incident, in which I am trying to pass the SysId and CI to a UI page. However, the dialog window does not render unless I remove the "dialog.addParam" lines

 

function updateAsset(){
 var sys_id = g_form.getUniqueValue();
 var dialog = new GlideDialogWindow('update_asset');
 dialog.setTitle("Update Asset");
 dialog.setHeight(800);
 dialog.setWidth(600);
 dialog.addParam('sys_id', sys_id);
 dialog.addParam('ci', cmdb_ci);
 dialog.render();
}
 
Can someone please point me in the right direction as to what I'm doing wrong? And also how to populate fields on the UI page with these values?
 
Thanks
 
Ray
22 REPLIES 22

@ray evans 

you can fetch the parameter values inside UI page HTML section itself and then use those in client script

to fetch directly in client script use this

var sys_id = "${JS:sys_id}";

var cmdb_ci = "${JS:cmdb_ci}";

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar  

 

Still not sure if I'm doing this right - in the html I have:

<g:evaluate var="jvar_ci"

    expression="RP.getWindowProperties().get('ci')" />

<g:evaluate var="jvar_sys_id"

    expression="RP.getWindowProperties().get('sys_id')" />
 
Is this correct?

@ray evans 

this should work in this way

expression="RP.getWindowProperties().get('cmdb_ci')" />

you want the value in HTML section or client script section?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 

 

I basically just want to populate a reference field named 'incident' and do a GlideRecord to get the asset value from cmdb_ci and populate another reference field named 'asset'. 

@ray evans 

can you share entire UI page script HTML, Client Script, processing script?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader