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

Ankur Bawiskar
Tera Patron
Tera Patron

@ray evans 

you are not passing the field value and hence it's failing there since you just added variable there but didn't declare it

update as this

function updateAsset(){
var sys_id = g_form.getUniqueValue();

var cmdb_ci = g_form.getValue('cmdb_ci');
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();
}

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

Hi @Ankur Bawiskar 

 

It's still not opening correctly:

rayevans_0-1688118970350.png

 

 

@ray evans 

I believe I answered your original question i.e. UI page was not rendering.

Next you need to debug the UI page

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

@Ankur Bawiskar :Rendering' was obviously not the correct term

can you please advise the correct syntax to retrieve these values in the UI page?

 

I have the following lines in the client script:

 

var sys_id = GlideDialogWindow.getWindow(window).getParameter('sys_id');
var cmdb_ci = GlideDialogWindow.getWindow(window).getParameter('ci');