multiple <g:ui_reference> fields in a UI page

xiaix
Tera Guru

UI Page containing multiple UI fields that need the same query on the same table.   One would assume that you can give a ui_reference tag a unique ID, as told here you can: http://wiki.servicenow.com/index.php?title=Extensions_to_Jelly_Syntax#.3Cg:ui_reference.2F.3E, but that's not true.

Here's a visual of an example:

Screen Shot 10-20-15 at 02.47 PM.JPG

And the code:

<g:ui_reference name="QUERY:location=${jvar_userLoc}" id="testOne" table="sys_user" />

<g:ui_reference name="QUERY:location=${jvar_userLoc}" id="testTwo" table="sys_user" />

And when we pull up the UI page and inspect the element:

10-20-2015 2-57-25 PM.png

So the obvious question:     How can I get multiple <g:ui_reference> fields that query the same table with the same query filter onto a UI page with different input id's?

1 ACCEPTED SOLUTION

Valor1
Giga Guru

David, you have to create a unique ID for each element. If you need to set a query, set the "query" attribute, not the "name" because, as you point out, the Name gets set as the input name when the HTML is generated:




  <g:ui_reference name="user_location1" id="testOne" table="sys_user" query="location=${jvar_userLoc}" />


  <g:ui_reference name="user_location2" id="testTwo" table="sys_user" query="location=${jvar_userLoc}" />


View solution in original post

5 REPLIES 5

Outstanding.   Thank you!