Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving text State from ServiceNow REST API

I'm building a fairly simple REST app for ServiceNow. Using the REST API Explorer (great tool!) and some examples on here I've been able to connect and raise Incident records with all the field information I need.

The only thing I can't seem to wrap my head around is how to pick up the text label of an Incident State - I can get the integer from the Incident record and I understand there is a relationship set up within the Dictionary between each integer and a corresponding label. Eg. Incident State=1, Label is "New"

Maybe I'm wrong, but I would expect I can look up another table via REST, pull out the integers and retrieve my text statuses? I've tried accessing the Dictionary table in the API explorer but this doesn't go far enough...any help out there please?

My goal for this integration is to raise an incident or request, and then when required report back the status of said record - been doing my head in for days...

like image 745
Rudy Avatar asked Apr 14 '16 22:04

Rudy


Video Answer


1 Answers

What you're looking for is a display value. You can set a query parameter using REST API Explorer named sysparm_display_value.

Value options are:

  • true returns display values for all of the fields.
  • false returns actual values from the database. If a value is not specified, this parameter defaults to false.
  • all returns both actual and display values.

From the wiki: here

Using the value all, this is what the payload returns for incident_state:

"incident_state": { "display_value": "On Hold", "value": "3" }

like image 72
Joey Avatar answered Sep 19 '22 04:09

Joey