Issue
glide_list set with display values with a comma in it, are not parsed correctly
Problem
When creating or updating a record that contains a glide_list field (for example, watchlist), if the input value has a comma in any of the values, the API treats the input as two (2) different values instead of one name that contains the comma.
Symptoms
-
Create a new user with a name of "test, user one".
-
Execute the following:
test(); function test() { var a = new GlideRecord("incident"); a.setDisplayValue("watch_list", "test, user one, abraham.lincoln"); a.insert() };
Note that watch_list has test, user_one, abraham.lincoln as three different entries.
Cause
The glide_list field parses values set as a comma-separated values.
Resolution
There are several possible options:
-
Remove commas from the display name of the relevant records.
-
Set the glide_list field with the relevant sys_id of the target records.
-
Use a string field to populate the required value.
-
Use a custom separator for values with commas that is then processed using logic within the instance.
glide_list field parses values set as a comma-separated list. The display value from getDisplayValue() can be customized with a separator by setting the property glide.ui.glide_list.separator to a string.