How do you pass field values to a GlideModal window?

e_wilber
Tera Guru

I'm using GlideModal to generate a popup window to load a form.  I need to preset one of the fields (parent) to the sys_id of the form that generated the popup.

I tried using setPreference('field', value) but that isn't setting the field and I don't see anything noted in the API documentation on how to do this.

var dialog = new GlideModal('incident'); 
dialog.setSize('500');
dialog.setPreference('parent',g_form.getUniqueValue());

2 REPLIES 2

Chaitanya Redd5
Tera Guru

Hi,

Could you please have a look on the below thread, this might be the one which you are looking for.

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

Kindly mark my answer as Correct and Helpful Based on the Impact.

Regards,

Chaitanya

Radek7
Mega Guru
Should be probably:
dialog.setPreference(
'sysparm_query', 'parent=' +g_form.getUniqueValue());