UI page containing reference field

Maria DeLaCruz
Tera Guru

Hi,

I need some help with a UI page (not very familiar with jelly script).   So, I would like to have a reference field on the UI page referencing the sys_user table.   This UI page will be used on a record producer, so when a user enters a name in that reference field and submits the form, I would like the Name reference field on my table record to be populated.


I have added the following line to my UI page, and the reference field does display on my form, but I'm not sure how to capture the value entered there, then save it on my table record.

<g:ui_reference name="QUERY:active=true^roles=service_desk" id="u_name" table="sys_user" style="width:180px"/>

Any assistance would be appreciated.

Thanks,

Maria

6 REPLIES 6

Chuck Tomasi
Tera Patron

Hi Maria,



While you CAN put the query in the name field, I feel it confuses things. Try this instead:



<g:ui_reference name="my_var" query="active=true^roles=service_desk" id="u_name" table="sys_user" style="width:180px"/>



I don't think style is going to do you any good.



You can then use the processing script to get your hands on the my_var value and save it using a server side script. See section 4 here:


http://wiki.servicenow.com/index.php?title=UI_Pages



For additional help - see videos 1, 2, 3 on this list: TechNow Episode List


Thanks, Chuck!   I'll give this a try.


How can I use a UI reference variable to only show one column? so that the search occurs in that column

tanumoy
Tera Guru

Use something like below. It will show in the UI Page.



<g:ui_reference label="Name" name="name" table="sys_user" field="user_name" />