- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2015 10:33 AM
I have a Catalog Item that has variables. When I perform a Get for a request Item for that Catalog Item (sc_req_item) via the REST API it doesn't return the values that were set for the variables on that Request Item. Is there a way to have these included in the Get or a way to query that information from the REST API?
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2015 10:56 AM
You need to use the variable ownership table (sc_item_option_mtom). Query by the Request Item and you'll get a list of variables for it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2017 12:02 PM
Hi Niranjan,
You should be able to look up those items in the table Joshua referenced above (sc_item_option_mtom). There will be an entry for each variable. So you can filter it for the requested item that you're looking for and then select the information for each of the variables for that requested item. So using a simple query it would look something like this:
var req_var = new GlideRecord("sc_item_option_mtom");
req_var.addQuery('request_item',"SYS_ID_OF_REQ_ITEM");//SYS_ID_OF_REQ_ITEM would be the sys_id of the request item your looking up
req_var.query();
while (req_var.next()) {
var req_question = sc_item_option.item_option_new;
var req_answer = sc_item_option.value
}
You could of course add these to an array, hash table, or whatever works for what you're trying to do.
Thanks,
David Bernard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2017 12:08 PM
Hi Bernard,
Thanks for the information. But i figured out how to access them.
we can use "current.variables.variable_name" to target variables on the requested item form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2017 03:15 AM
Hey David,
i have tried your script, but i didn't get any response, i just need to get the request number against variable name of raised item, can you just provide the sample example that helps me to get the raised request details against variable name of catlogue item. or some workaround solution.
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 09:11 AM
Thank you for the answer..but I have another question?While query sc_item_option_mtom i need to filter only the visible variables on the forms.
But i am getting all the variables. How we can do that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2015 12:18 PM
Hi David,
If you are using JSONv2, you can accomplish this with the displayVariables parameter: JSONv2 Web Service - ServiceNow Wiki