List field value

Colleen
Tera Expert

I know that the List data type can use either a hard-coded choice list or reference a table.  If the List uses a choice list, its value is a comma-separated list of choice values.  If the list references a table, its value is a comma-separated list of sys id's from the referenced table.

 

Is there any way to get the list data type that references a table to use a field other than sys_id as its value?

3 REPLIES 3

Nilesh Wahule
Tera Guru

Hi @Colleen ,

Unfortunately NO! as you know that reference fields always holds the sys id as the value, its the same for the list type of references. It holds the sys ids of the records selected. 

 

I think, though it holds sys id as value, on the form it will always show up as display value for the better user experience. 

 

May I know why you are looking for the alternate field as a value for it?

 

---------------------------------------------------------------------------------------------------

Please mark my answer as helpful/correct if it resolves your query.

Thanks,
Nilesh Wahule

LinkedINlinkedin.com/in/nilesh-wahule/

---------------------------------------------------------------------------------------------------

 

@Nilesh Wahule 

 

Thanks for replying.

 

I want to convert a list field that currently uses a hard-coded choice list to reference a table instead.  The table has label and value fields.  If I could configure the reference list to use the value field rather than sys_id then I would not have to run a script to change the list field value on existing records.

 

Also, a GlideRecord query on the list field will return more useful information if the list field stores a user readable value rather than a sys_id / GUID which is a random 32-bit hexadecimal string.

@Colleen  - I understand that you need to run the script to migrate from the older choice list to dynamic reference list. And storing the sys id is more logical way cause of following reason. 

 

Lets say, we are able to change that to value field from your table as your requirement. But what you will achieve by doing this ? user readable data- That anyhow user is having as label. backend value is meant for the developer, so we getting sys id is always better than getting the text. as there could be duplicate values for same text in your table but the sys id is always unique. Even when we do glide record with sys id and get method, it improves the performance. 

 

So in my opinion, The existing approach of storing sys id is correct. you should just run the fix script to migrate.

 

---------------------------------------------------------------------------------------------------

Please mark my answer as helpful/correct if it resolves your query.

Thanks,
Nilesh Wahule

LinkedINlinkedin.com/in/nilesh-wahule/

---------------------------------------------------------------------------------------------------