REST POST - Reference Field Display Value Issue

jcote
Giga Expert

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.

4 REPLIES 4

drjohnchun
Tera Guru

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 see John's LinkedIn profile

visit snowaid


ServiceNow Advocate

Winner of November 2016 Members' Choice Award


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.


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.


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.