Add multiple values in reference field

Anuja Jadhav1
Tera Contributor

We have a custom table where we are using the 'user_name' field from the 'sys_user' table as a reference in the custom table. We are looking to populate that field with multiple values, like an array or list.

Is it possible to do so, and if yes, how would we go about it?

3 REPLIES 3

Sumanth16
Kilo Patron

Hi @Anuja Jadhav1 ,

Reference field value holds only one value in the field. Change the field from Reference to Glide LIst field.

Glide List fields are a field that can hold many reference values at a time (as opposed a reference field that holds just one value.) The most familiar example of a glide list is the Watch list field on the task table (incident, problem, change, etc.) However, this script works on any glide_list.

Please refer to below thread:
https://www.servicenow.com/community/in-other-news/managing-glide-lists/ba-p/2279191


Thanks & Regards,
Sumanth Meda



Tony Chatfield1
Kilo Patron

Hi, testing quickly in a PDI, you can change the data type of an existing reference field to be a type of list via Configure Table.

Aman Kumar S
Kilo Patron

Hi @Anuja Jadhav1 

Reference type fields are supposed to hold only one value, for story multiple values, you need List type field.

And when it comes to switching dictionary types, its Servicenow recommendation not to change the dictionary type of the field, rather you can create a new field with the type = List and  move your entries from old field to new and deactivate the reference field.

Excerpt from the article:

Unsupported:

A data type change where a string is changed to an integer is not supported as both of these data types from the front end map to entirely different data types in the backend and will most likely result in an online alter. Please note that performing such changes where data is present can result in data loss when making unsupported changes. If a data type change is absolutely necessary ServiceNow recommends creating an entirely new field of the type that is needed.

Follow below servicenow article on dictionary changes to understand better:

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0712394

 

Best Regards
Aman Kumar