How to specify reference qualifier inside a UI Page

johannes5
Giga Expert

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

1 ACCEPTED SOLUTION

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>




View solution in original post

9 REPLIES 9

Abhinay Erra
Giga Sage

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


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.


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.


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. 🙂


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