Is it possible to update the RITM variables via a REST call to the sc_req_item table?

Dean29
Tera Contributor

I need to update a variable on a RITM via the inbound REST API.

I know that the variable values live on the sc_item_option table, which is linked to the sc_req_item table via the sc_item_option_mtom table.

I've been told that I can update the variables via a PUT call to the sc_req_item table if the variable and variable value are passed in the request body, but I haven't been able to get that to work.

Am I right in thinking this wouldn't work, and that any change to a variable value will require a PUT call to the sc_item_option table directly?

I'm seeing conflicting information in the community on what I've found so far, with some people indicating it can be done via a PUT to sc_req_item, but am not seeing the question asker come back and confirm that working for them after the response is given...

Thanks!

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

yes the value for variable are stored in different table and not in sc_req_item table

they are stored in this table "sc_item_option"; I would recommend to use scripted rest api for this instead of using out of the box table API

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

yes the value for variable are stored in different table and not in sc_req_item table

they are stored in this table "sc_item_option"; I would recommend to use scripted rest api for this instead of using out of the box table API

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thank you for your help!

Vivek13
Tera Contributor

Hi,

I have the same requirement. Did you achieve this? were you able to update the RITM variables using the Scripted API. If so could you please share me the sample script? and how you did it.

Thanks

Dean29
Tera Contributor

Yes, I was able to complete it. I used a scripted REST endpoint, which in turn used a script include that I created to deal with changing the variables. I believe it took in the name of the variable and the sys_id of the RITM.

I'm not sure that I'm allowed to share the actual code, but this graphic was super helpful when it came to identifying the tables I needed to worry about with the variables:

https://community.servicenow.com/7cf23842db5c5f048c8ef4621f961954.iix