get field values into Ui page

Shiva Kumar8
Kilo Guru

Hi Community,

I'm trying to fetch the Name value on User record to a field in UI page calling on same record(please find the attached screenshot) can I get some help in prepopulating the Name into the User name(see screenshot) using any script in UI page.

Thanks in advance.

1 ACCEPTED SOLUTION

Abhijit4
Mega Sage

Hi,

You will have to pass sys_id not name as your field on UI page is reference field.

In UI action, you will have pass it by below method.

var dialog = new GlideDialogWindow("test_dialog"); //Render the dialog containing the UI Page 'task_comments_dialog'
		dialog.setSize(1250,500);
		dialog.setTitle("Page Title"); //Set the dialog title
		dialog.setPreference("user_sys_id", g_form.getUniqueValue());
		use in the dialog
		dialog.render(); 

Access and set reference filed in UI page as below,

<g:ui_reference name="user" id="user" table="sys_user" value="${RP.getParameterValue('user_sys_id')}" completer="AJAXTableCompleter"/>

Let me know if you have any further queries.

Please mark this as Correct or Helpful if it helps.

Thanks and Regards,
Abhijit

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

View solution in original post

5 REPLIES 5

How was this use case resolved finally? Any update?