REST POST - Reference Field Display Value Issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2016 10:47 AM
SNC Community,
We have an external system using the Table API to create a record on a table in ServiceNow.
How do we pass a name/string value to a reference field and have the reference field display that value?
The Reference Field values are not populating as expected. We can only have one "display" value at the dictionary level. So we are trying to figure this out. We can't have the external system send a sys_id (true database value of a reference field), and instead they have to send the name. The name being sent over is a valid value for a reference field name. Setting "Display" to true at the dictionary level works, but only one field on a table can be set to true and we have multiple reference fields with the same issue here. The values are empty. We placed a name field in the reference key field at the dictionary level and this did not work.
Here is an example of the JSON used to create the record via POST:
{"u_short_description":"Jamison - Test","u_event_id":"Test ID"}
Say that u_event_id is a reference field and the name value of a record is "Test ID". All string values work and we are only having issues with Reference fields.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2016 11:04 AM
Using a Display Value to set a reference field works just fine using the Table API. I just tested using the REST API Explorer. Can you test your case using the REST API Explorer?
Hope this helps.
Please feel free to connect, follow, mark helpful / answer, like, endorse.
John Chun, PhD PMP ![]() | ![]() |
Winner of November 2016 Members' Choice Award
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2016 11:07 AM
Thanks for the reply.
I was able to successfully test this with the REST API Explorer and the result was as expected - I passed a name/string value to a reference field and it was populated.
It's an external service that is successfully authenticating and creating a record and receiving an HTTP Status of 201 upon POST/creation. The service account authenticating has full access to the tables and reference fields via the associated ACL's.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2016 11:27 AM
Can you try testing it in REST API Explorer using the same credentials used by the external system? You may also want to confirm the ACLs for the reference tables just to be sure.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2016 11:29 AM
Right, I have used the service account credentials for the REST API Explorer - same issue - blank reference field values.
I will double check the ACL's now.
Thanks.