Fetching "Variables" values in REST API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2016 11:31 AM
Dear all,
Our ServiceNOW Setup has some custom variables defined for Request Items. e.g. "Requested for:". Is it possible to get the values for these parameters defined under Variables via REST API Dot Walking or any other REST option?
Thanks in advance!
S. Gatade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2017 06:41 AM
Try this. This helped me a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2019 05:35 AM
That is a wonderful article! Thanks a lot to put it here. 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2022 06:27 PM
In your REST API call, you can add variables.VAR_NAME
to your sysparm_fields
list, where VAR_NAME
is a variable name you want to add, eg (here the %2C
represents a comma ,
in an encoded URL):
https://your_instance.service-now.com/api/now/table/sc_req_item?sysparm_fields=number%2Cstate%2Cvariables.VAR_NAME
This will give you back, the fields number
, state
and the variable VAR_NAME
in the result. Note that the result won't include variables.var_name
if the record doesn't have this variable associated with it. For reference fields/variables, you can look at updating the sysparm_display_value field to true
or all
to avoid showing just the sys_id. The above will work for both OoTB tables and custom tables.