- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2016 01:24 PM
Hi ServiceNow Community Developers
I have a requirement to change the oob 'consume_a_consumable' UI Page and include the 'To building' field to it. I am able to do this however I am running into an issues that I am not sure how to overcome.
I need to lookup only active buildings however I don't know how to specify that inside a UI Page. For instance once I declare the field name and the table name using the following code:
<td><g:ui_reference name="cmn_building" table="cmn_building"/></td>
how do I then specify that when the magnifying glass is clicked I only need to see active buildings in the lookup list. Right now when I click the magnifying glass I see all buidlings, I would like to filter out inactive ones but I don't know to accomplish that. Please advise.
Thanks,
Johannes
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2016 01:37 PM
Cory, according to the UI Macro ui_reference, there's an attribute "query".
<td><g:ui_reference name="cmn_building" query="active=true" table="cmn_building"/></td>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2016 01:36 PM
Johannes,
refer to section 14 in this link.
Extensions to Jelly Syntax - ServiceNow Wiki
Thanks,
Abhinay
PS: Hit like, Helpful or Correct depending on the impact of the response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2016 01:42 PM
I'm glad this came up. I learned a few things! Didn't know about putting the query in the name. Not sure WHY someone would do it that way when there's a query attribute, but hey - nice to know it's there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2016 01:48 PM
We should probably document the query attribute on the wiki, too- especially since we specifically call out the ui_reference macro in the Extensions to Jelly Syntax page.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2016 01:50 PM
When in doubt, I check the comments in the UI Macro and verify each variable mentioned there has a jvar_ counterpart in the code. I trust that over the wiki. 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2016 04:35 PM
Hi Guys,
Thanks to all of you for your help. ctomasi's answer is the one I tried and it works for me.
Thank you,
Johannes