API Rest post incident display values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2017 10:06 AM
Hi guys,
I'm trying to post incidents using the Rest API in JSON format. In our system, we have dependent values which some of them are the same for different products.
The problem is when I try to post an incident with the categorization as display values (not the actual values) in SNOW appears with the wrong dependent one (from another product)
I have, for instance, the following categories and subcategories:
1.
Label: USI Value: USI
Label: ARCHIVE Value: ARCHIVE_USI Dependent value: USI
2.
Label: USI 2 Value: USI_2
Label: ARCHIVE Value: ARCHIVE_USI_2 Dependent value: USI_2
if I send the following:
{"u_product_component":"USI 2","u_component_detail":"ARCHIVE"}
In SNOW appears as:
Product Component: USI 2
Component Detail: ARCHIVE_USI
Expected result:
Product Component: USI 2
Component Detail: ARCHIVE
I have also tried to include "sysparm_input_display_value=true" in the URL but the result is the same
Any ideas will be appreciated!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 06:08 AM
Hi Gabriel,
Q: Are you using the table API or the import set API? It sounds like the import set API will work better for you since it allows you to transform the display values in to actual values in the transform map/script.
Example:
target.u_product_component.setDisplayValue(source.product_component);
http://wiki.servicenow.com/index.php?title=Import_Set_API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 07:01 AM
Hi Chuck,
We are using the Table API, I checked and we don't have the incident table in the Import set API stagingTableName drop down although I guess it can be added.
But, isn't it supposed to work with the Table API as well?
Why are my values different in the UI compared to values I use for POST or PUT?
The UI shows the display value of actual data in the database, which is manipulated data. The REST API inserts and updates values as given in requests and they can be different from what you see. You can force the REST API to treat input values as display values by passing the sysparm_input_display_value request parameter.
https://hi.service-now.com/kb_view.do?sysparm_article=KB0534905

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 08:18 AM
You wouldn't use incident as the staging table. Incident would be the target table of your transform. Your staging table is where the imported data goes (whether it is from a web service, Excel file, or some other data source.)
http://wiki.servicenow.com/index.php?title=Importing_Data_Using_Import_Sets
The idea is that your REST API would come in to the staging table via the import set API and get processed by the transform and end up in the incident table. This is best practice instead of inserting/updating directly to the target table (incident.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 09:26 AM
I will try to explain what we are trying to do because maybe it is not clear.
We want to be able to create an incident using the API from a Java application in which we can fill up all the fields and get back the incident number once it is created
This is how it should look like:
And this is how it looks like after sending the incident using the table API
You suggest to use the import set API but it seems that the purpose of such API is to import data from different sources (files, web services...) do you think it could work for our goal, keeping in mind that we only want to create new incidents using the external app and getting back the Incident number created?