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

Hi Kalai,



Concatenating a reference field to an empty string ('') will automatically cast the value to string.



Thanks,


Berny


Yup. I noticed that after responding. Hence I asked for a instance to look into. Tablename could be wrong, field name could be wrong, honestly I don't see any other alternative than to see the code in a instance.

Agree