How to retrieve all valid values for a element in a specific table?

EricZ1
Tera Contributor

I am trying to retrieve all valid values for elements in different tables. I have noticed that if a record is created with an invalid value for a element using the Table API (e.g. incident table -> category -> "invalidcategory" value), the record will be created but its value will be a default value ("inquiry").

I found that you can use the sys_choice endpoint to retrieve options for specific tables, but the problem is that sometimes restricted values are inherited from a "parent table" (e.g. 'incident' inherits from 'task' values for the 'upon_reject' element). However, at other times the child table does not inherit from its parent table. For example, both 'task' and 'incident' have a 'short_description' element, but only the short_description for 'task' is restricted.

How do I retrieve all valid values for elements belonging to a specific table, including those inherited from the parent table if any?

2 REPLIES 2

Basheer
Mega Sage

Hi @EricZ1 ,

The below post may be useful for you

https://www.servicenow.com/community/developer-forum/how-to-get-all-field-values-and-store-it-in-a-s...

 

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.

EricZ1
Tera Contributor

Hi Basheer,
Thank you for the reply. I am primarily interested in the REST APIs. Is there a method/endpoint to retrieve valid values for fields in a table (besides sys_choice which does not seem to return inherited values and the like)?