- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2015 08:23 PM
Using table api with the following query
https://<site>/api/now/table/sys_choice?name=sometable&element=somecolumn
returns json
{
"result": [
{
"label": "High"
},
{
"label": "Medium"
},
//etc
]
}
How do you get the value column to be returned? I've tried "sysparm_display_value=all". I've tried "sysparm_fields=label,value". Nothing works...when I specify a column that exists on the sys_choice table that is not "label" i get empty results...the correct number of results, but all empty
{
"result": [
{},
{},
//etc
]
}
What i want is
{
"result": [
{
"label": "High",
"value": "1"
},
{
"label": "Medium",
"value": 2
},
//etc
]
}
Seems like a simple thing to do...can't seem to figure it out...when i query another table like incident with no filters or field specifications all the fields are dumped as expected...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2015 11:03 AM
This is happening due to an ACL issue, the user doesn't have the "personalize choices" role so they only data on the sys_choice table they can see is the label, to correct this apply the "personalize", "personalize choices", or "personalize response"s role to the user you are running the query with and they should be able to see the rest of the fields on the sys_choice table. Alternatively you could alter the ACL that allows for all fields to be read on the sys_choice table.
-JB

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2015 05:17 AM
Allen,
Does sysparm_query doesn't work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2015 05:27 AM
Sorry, yeah, I missed it:
api/now/table/sys_choice?sysparm_query=name=sometable^element=somecolumn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2015 06:42 AM
The query is not the problem. Both sysparm_query and name value pairs work equally well. The problem is that only the label column is returned and none of the other columns, specifically i need the value column returned.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2015 06:48 AM
I'm doing a similar exercise with postman, and the only column that is returned is label...how do i get the rest of the columns to be returned in the json result?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2015 06:53 AM
In soapUI, they return by default. That is what I get from the screenshot I posted. So, they are in the response by default. I don't know why postman does not return the full response.