Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Distinct or unique values on reference field / lookup

Nik Amy
Tera Contributor

Hey all

On a form i have created a reference field which points to a custom table and this table has NO UNIQUE key.

So upon clicking the lookup icon, it should display only unique or distinct values like below it should show only 1200 and 1300.

 

      VenIDName
1200ABC
1300XYZ
1200JKL

I have made use of reference qualifier and wrote a code like

vendorIdList = arrayUtil.unique(vendorIdList);

This is working, but since the table has some thousands of records, its taking very long time to display the unique values.

Any other method to achieve this quickly.

TIA

17 REPLIES 17

Yes Berny. Its checked only


And if that still doesn't work, can you reproduce this in any demo instance?


Replace


return 'sys_idIN'+ticket_id+'';


With


return 'sys_idIN'+ticket_id.toString();




And


return 'sys_idIN'+'***'; //


With


return ''; //


Hi Kalai,



Still returning null values.



What i found was like its not returning values when GlideAggregate is used.


when i replaced


  ticket_id.push(ticket_list.sys_id+'');


with


  ticket_id.push(u_ven_id.sys_id+'');



it will atleast populate the values (but not unique)



Any other idea



Thanks


Nikh


Use toString() whenever you are pushing value into array. Can you change that?