Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Retrieve lookup values using API

sandipc
Kilo Explorer

How can I get Lookup type field values??
For Example:Incident has a field named Incident State.The values which we can select are New,Active,Awaiting Problem etc.My question is how to retrieve these values using API ???






Thanks

Sandip

1 REPLY 1

john_andersen
Tera Guru

The API will require the actual values instead of the display/pretty values.

To get this manually, as an administrator, you right click on the field in the form and click on "Show Choice List".

find_real_file.png

This will show the list of choices with their actual database value as well as their display value. Use the values in the "value" column for the API:

find_real_file.png

If you are looking for something programmatic to do this, you will need to make a separate call to the sys_choice table and query on the table and the label to get the value. However, I would recommend just coding in the value into your script rather than make another SOAP call to get the value.