Get Task/RITM details from REST API

karanpreet
Tera Guru

Hello,

I'm trying to get details for a TASK/RITM that has variables such as check box, multiple selection buckets etc. through the REST API.

If I try to get just the Task/RITM it does not include the variables, even though they show up in the UI. I searched around a bit and found that I needed to use the "sc_item_option_mtom" and "sc_item_option" tables to get the details. I tried to get the details for one particular Request but see that a few of the results I get from sc_item_option table are just blank where the item_option_new and value should be and do not include

How can I get all the values of the variables through the REST API?

Thanks,

Karan

 

8 REPLIES 8

Omkar Mone
Mega Sage

Hi

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 Correct if it helps.

Warm Regards,

Omkar Mone

find_real_file.png

www.dxsherpa.com

Hello,

I already have that in place and can get the list of options for the RITM back fine but am not able to get the details for the variables/options using the sc_item_option table.

Thanks,

Karan

Kiran7
Giga Expert

Hi Karanpreet,

Please refer bellow link that will resolve your query:

https://snprotips.com/blog/2016/7/15/scripted-rest-apis-in-servicenow-how-to-retrieve-catalog-item-variables

Please hit helpful/correct on the impact of the answer.

 

Warm Regards,

Kiran Salunkhe

Engineer


www.DxSherpa.com

karanpreet
Tera Guru

It turns out the issue was with the number of items being returned and not the values being returned.

 I had a limit in my REST API call for 10 items and it turns out there are quite a log of variables on the form. Once I changed the limit to 100, I could get all the required details.

/api/now/table/sc_item_option_mtom?sysparm_limit=10&sysparm_display_value=true&sysparm_exclude_reference_link=True&sysparm_query=request_item%3D<request item sys_id>&sysparm_fields=sc_item_option

Thanks,

Karan