servicenowservicenow-rest-api

Get Available States for ServiceNow Table Using API


I'm working with the ServiceNow API and I'm able to pull data from the Table API without issue. What I can't seem to find is any documentation on the different states that might be available on a specific table.

What I'd like, if possible, is to find an API call that will take in a table name and return a list of available states that can be set. Or, short of that, I'd just like to know if this data is even publicly available from ServiceNow.

Any direction is appreciated.


Solution

  • States for fields are simply just stored in the sys_choice table. You can use the Table API like you said you were doing without issue, but to query the sys_choice table to get the available states:

    sys_choice

    That query will give you a result set of all the relevant choices. The value to save in your field is stored in the value property of the results, and the name of the choice will be in the label property of the results.