The CreatorCon Call for Content is officially open! Get started here.

Trying to get Array to return: Reference Qualifier

Bob
Giga Contributor

function deptFilter() {

var arrayUtil = new ArrayUtil();

var a1 = [];

var gr = new GlideRecord('u_university_approvers_list');

gr.addNotNullQuery('u_department');

gr.query();

while (gr.next()){

a1.push(gr.u_department.name);

}

var strQuery = arrayUtil.unique(a1);

      gs.log(strQuery);

return strQuery;

}

Trying to get this to return in a reference qualifier. The gs.log comes back as:

1 ACCEPTED SOLUTION

carlosloza
Kilo Expert

Hello,



Returning the list of names, you will have to concatenate at the start of string the field for your query, something like:



//replacing line 12 with:


return "nameIN"+strQuery;



you can also return the sys_id's and return a string like:



//replacing line 8 with:


a1.push(gr.getValue('u_department'));


//replacing line 12 with:


return "sys_idIN"+strQuery;



this is because the reference qualifier is expecting values, not display values, so I would suggest using sys_ids;



hope this helps


View solution in original post

3 REPLIES 3

randrews
Tera Guru

when you hit the search list for your ref qualifier <the spy glass by it> what options are presented??



there is a script include called "GetMygroups" and getmygroupsadvanced" that does this exact thing you can look at either one <they are script includes> to figure out how they load the ref qualifier.


carlosloza
Kilo Expert

Hello,



Returning the list of names, you will have to concatenate at the start of string the field for your query, something like:



//replacing line 12 with:


return "nameIN"+strQuery;



you can also return the sys_id's and return a string like:



//replacing line 8 with:


a1.push(gr.getValue('u_department'));


//replacing line 12 with:


return "sys_idIN"+strQuery;



this is because the reference qualifier is expecting values, not display values, so I would suggest using sys_ids;



hope this helps


Bob
Giga Contributor

Thanks Carlos for the help!