- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
I'm making a Table API call to my instance and specifically setting sysparm_display_value=all so that I get the value and display value for all the properties on the record I am retrieving... Unfortunately, for some properties the JSON being returned (I can't determine a pattern of why some do and some don't) exclude "display_value" which results in my program thinking the value is null when the "value" is "" (which is a blank and not technically null).
Does anyone know why it seems like ServiceNow randomly decides when it's going to return a display value or not? Here are some examples from a call against the incident class on my instance... Close Code and Timeline did not return "display_value" but sys_tags and Parent Incident did... So even though sys_tags and Parent Incident as "", their display value is still obtained and saved as "" on my side whereas both Close Code and Timeline also have a value of "" but since there is not a display value in the JSON, they are saved as null on my side...
"close_code": {
"value": ""
}
"sys_tags": {
"display_value": "",
"value": ""
}
"timeline": {
"value": ""
}
"parent_incident": {
"display_value": "",
"value": ""
}
I know I could do some hard coding to handle these situations but I'm trying NOT to modify the data in anyway so I can record it as it is in ServiceNow... Any thoughts on the inconsistency?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hello amiller,
This is a common behavior in ServiceNow's Table API. The display_value field only appears in the response when:
Reference Fields: For reference fields (like parent_incident), ServiceNow provides display_value to show the display name of the referenced record.
Choice Fields: For choice fields (like close_code), display_value shows the label while value shows the actual stored choice value.
Empty Non-Reference Fields: For string fields like timeline and sys_tags, when the value is empty, ServiceNow often omits the display_value entirely since it would be identical to the empty value.
The pattern you're observing is expected - reference fields get display_value even when empty, while standard string fields may not.
Workaround Suggestions:
Check the field type in your instance's dictionary for each field
Implement logic to handle cases where display_value is missing
Consider using sysparm_display_value=true instead of all for consistent behavior
This inconsistency is by design based on field types and their content.
Hope this helps!
Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it helpful & accept the solution so others can benefit as well.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
This ones that are not sending display value are probably string fields. So in javascript could check for this by doing something like the below.
var valueToUse = "";
if(obj.field.display_value) {
valueToUse = obj.field.display_value;
} else {
valueToUse = obj.field.value;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Thank you for the code sample. I was afraid I'd have to do this, but it is what it is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hello amiller,
This is a common behavior in ServiceNow's Table API. The display_value field only appears in the response when:
Reference Fields: For reference fields (like parent_incident), ServiceNow provides display_value to show the display name of the referenced record.
Choice Fields: For choice fields (like close_code), display_value shows the label while value shows the actual stored choice value.
Empty Non-Reference Fields: For string fields like timeline and sys_tags, when the value is empty, ServiceNow often omits the display_value entirely since it would be identical to the empty value.
The pattern you're observing is expected - reference fields get display_value even when empty, while standard string fields may not.
Workaround Suggestions:
Check the field type in your instance's dictionary for each field
Implement logic to handle cases where display_value is missing
Consider using sysparm_display_value=true instead of all for consistent behavior
This inconsistency is by design based on field types and their content.
Hope this helps!
Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it helpful & accept the solution so others can benefit as well.