We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Reference qualifier on glidelist ui macro

absd
Mega Contributor
 

Hi All,

i have a Glidelist type field on ui page which is referring to Group table which i invoked from the oob ui macro "lightweight_glidelist". I want to put a reference qualifier on that field. how can i do that.

Thanks in advance

8 REPLIES 8

Ankur Bawiskar
Tera Patron

Hi,

Have custom UI macro and add ref qualifier in that. Have something similar to this

<g:ui_reference name="reference1" table="sys_user_group" completer="AJAXTableCompleter" query="QUERY:javascript:new ReferenceQualUtils().getDefaultGroups();"/>

in that script include you can send list of sys_ids

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

 

The above tag is i think for a reference field reference qualifier but in my case am invoking the GlideList macro. Plz find the highlighted part where am invoking the macro and i want to put on a filter where it should only return the group name which contains cab.

 

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

<label> </label>
<g:ui_form>


<input type="hidden" name="result" id="result" value=""/>
<input type="hidden" id="incidentSysID" name="incidentSysID" value="${sysparm_sysID}"/>

<label>Type</label><br>
<select name ="a">
<option value="Estimate">Estimate</option>
<option value="ROM">ROM</option>
<option value="Assement">Assement</option>

</select>


</br>
<br></br>

<g:evaluate var="jvar_list">


var ug = new GlideRecord('sys_user_group');


ug.addEncodedQuery("nameLIKEcab"); // use your jelly variable here for the group to filter


ug.query();

 

var list = []; // create an array of user IDs


while (ug.next()) {


list.push(ug.sys_id); // add record's user to list as a member of that group


}

 


gs.info('hello123'+" "+list.length);

 

</g:evaluate>

<label>Groups</label>

<g:macro_invoke macro= "lightweight_glide_list" id="a_group" name="a_group" control_name="myListCollector2" reference="sys_user_group" can_write="true" />

<br></br>

<label>Requested Due Date</label>
<g:ui_date_time name="from_date" id="from_date" />

<br></br>
<g:dialog_buttons_ok_cancel ok_text="OK" ok_title="OK" ok="return actionOK();" cancel_text="Cancel" cancel_title="Go back to template" cancel="return cancel();"/>

</g:ui_form>
</j:jelly>

 

Thanks,

Abinash Dash

Hi Abinash,

Following links you can check

https://community.servicenow.com/community?id=community_question&sys_id=5407c7e5db1cdbc01dcaf3231f961923

https://community.servicenow.com/community?id=community_question&sys_id=4182c321dbd8dbc01dcaf3231f961993

https://community.servicenow.com/community?id=community_question&sys_id=a8be72a5db58dbc01dcaf3231f9619c1

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

 

I have gone through these links but they are still unanswered. I just want thw=e way we can use query in reference macro do we have anything similar for glidelist. query doesnt seems to be working have tried that as well..

 

Thanks,

Abinash Dash