Inconsistent Display of List Field Values as Links or Strings Based on Choice Label Content

Saraswathi Devi
Tera Contributor

Dear Community,

I've encountered an issue with a list field in ServiceNow that I'm hoping someone can shed some light on. The problem is that the field displays values inconsistently: some appear as links, while others as strings.

Upon investigation, I noticed that the discrepancy seems to be related to the choice label content. Specifically, when the choice label contains a comma, the value is displayed as a string instead of a link.

Has anyone else experienced this issue? And if so, is there a workaround or a solution to ensure consistent display of values as links regardless of the choice label content?

Any insights or suggestions would be greatly appreciated.

Thank you in advance!

1 ACCEPTED SOLUTION

@Saraswathi Devi Thanks a lot for sharing the further details, I tried to reproduce this issue and found that the link breaks if the string contains comma (,) in it.

 

Screenshot 2024-05-15 at 6.03.31 PM.png

Also, found a support article stating that , in name of elements in list should be avoided as it is used to separate the elements in the list. Here is the link to the article https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0622075

 

Here is what the resolution section in the aforementioned article states.

 

  • 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.

You can also try and use a custom separator by setting the property  glide.ui.glide_list.separator.

 

Hope this helps.

View solution in original post

3 REPLIES 3

Sandeep Rajput
Tera Patron
Tera Patron

@Saraswathi Devi A List field in ServiceNow can store two types of values.

1. Reference to other table (in form of sys_ids)

2. Choice values

 

Here is an example 

Screenshot 2024-05-14 at 9.43.59 PM.png

Here Employee type and Names are List type fields, however employee type has values with hyper links where as Names field have values in form of comma separated strings.

 

#1 Values as hyper links: In the first example the employee type fields stores references to other table, then clicking on the link the record opens up in a separate tab. Here is how you can specify a reference on a List field.

 

Screenshot 2024-05-14 at 9.53.52 PM.png

 

 

#2 Values as string: Apart from storing reference to other table, you can also store multiple choices inside the list field. Selected choices will be stored in form of a comma separated string. Here is how you can configure choices on a List field.

Screenshot 2024-05-14 at 9.57.20 PM.png 

Hope this clarifies you confusion. 

 

Please mark the answer helpful and correct if it manages to answer your question.

Hi @Sandeep Rajput ,

 

Thank you for taking the time to respond to my question. My problem arises from utilizing a list field of reference type, which displayed the links correctly.

SaraswathiDevi_0-1715750115671.png

However, when attempting to alter the reference's label from "Business Intelligence & Salesforce" to "Business Intelligence, Salesforce" by replacing "&" with "," the display changed unexpectedly.

SaraswathiDevi_1-1715750240197.png

I am not even changing the value of that field but still it shows like this.

I believe I've explained the situation clearly. If you have any further questions or need additional information, please don't hesitate to ask. 

@Saraswathi Devi Thanks a lot for sharing the further details, I tried to reproduce this issue and found that the link breaks if the string contains comma (,) in it.

 

Screenshot 2024-05-15 at 6.03.31 PM.png

Also, found a support article stating that , in name of elements in list should be avoided as it is used to separate the elements in the list. Here is the link to the article https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0622075

 

Here is what the resolution section in the aforementioned article states.

 

  • 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.

You can also try and use a custom separator by setting the property  glide.ui.glide_list.separator.

 

Hope this helps.