CMDB Instance REST API and Reference fields when creating records from external system
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2019 05:30 AM
Hello,
I have an external system posting data to our ServiceNow instance through the CMDB Instance REST API.
The issue is with Reference fields: I cannot find a way to send the name or display name of a reference field through a POST and have ServiceNow get the proper record in the table referenced to reference it in the CI.
E.g.: the external system is sending a manufacturer along with each CI. The manufacturer is sent in the request body with it's name and not sys_id (manufacturer:XYZ). When API is called, ServiceNow use the name as a sys_id so it doesn't match a record and the manufacturer is empty when the CI created (manufacturer field reference the core_company table), even though a company exists with the name XYZ.
I tried different things to fix that but cannot solve. Note that the external system cannot request the related record sys_id first through another API call.
Thanks for your help!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2019 05:36 AM
Have you taken a look at sysparm_display_value? I've used it on outbound REST requests, but haven't tried it with inserting in to tables. Try setting it as sysparm_display_value=true.
sysparm_display_value | Data retrieval operation when grouping by reference or choice fields. Based on this value, the query returns either the display value, the actual value in the database, or both.
|
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2019 05:44 AM
Hi Chuck, thanks for your reply. I did try this one but it didn't help (just tested again with REST API Explorer).
I also tried sysparm_input_display_value=true query parameter but it seems like this parameter is only for the table API and not the CMDB instance API.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2019 06:45 AM
Sorry about that. I thought you were using the table API and was unaware of the CMDB Instance API until now. Good to know. Sorry there's no sysparm_display_value thingy for CMDB Instance API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2019 06:45 AM
Are you using the CMDB API so you data goes through the IRE (Identification and Reconciliation Engine)?
You might need to make a second call to get those sys_ids for company data.