Need to get the unique values for a reference field

Yesh
Tera Contributor

Hi Team,

My reference field is visible like this:

IM Argentina Operating Unit

IM Argentina Operating Unit

IM Argentina Operating Unit

IM Argentina Operating Unit

IM BR OU

IM BR OU

.............

But I need the unique Values.

How to achieve this requirement?

Thanks,

Yesh

1 ACCEPTED SOLUTION

Nikhil65
Mega Guru

Hi @yesh ,

Why don't you get all sysid into an array, then use unique of arrayUtil class.

Then you can populate the select box with the unique values of array.

Api | ArrayUtil - ServiceNow Developers

 

Hope this helps!

 

Thanks,

Nikhil

View solution in original post

11 REPLIES 11

Sagar Pagar
Tera Patron

Hi,

have you checked your reference field display value? Is it showing the similar values to IM Argentina Operating Unit or not?

I guess it is reference field which shows these values (concatenate the two or more fields).

Can you share the reference table fields

 

Thanks,
Sagar Pagar

The world works with ServiceNow

Yesh
Tera Contributor

Hi @Sagar Pagar ,

Yes, it is similar to IM Argentina Operating Unit.

 

Hi,

You have to use the unique field to display in reference field.

 

Thank,

Sagar Pagar

The world works with ServiceNow

Yesh
Tera Contributor

Hi @Sagar Pagar ,

Okay. But I need the Plant Names to be displayed and those should be unique. Is it possible to do?

Thanks,

Yesh

Hi,

You have to control it through the Advanced reference qualifier.

 

For Script Include & Advanced reference qualifier, go thorough this old thread - How to display only unique values from the Reference variable

 

Thanks,
Sagar Pagar

The world works with ServiceNow