Get variable values from RITM via API

ShAn21
Tera Guru

Hi Team,

I have a requirement where the client wants to get all the variable values by sending the RITM number.

 

Do we have any OOB APIs available right now to fetch all the catalog variables from a RITM. I dont see any option in the sn_sc service catalog API. Is table API a feasible Option?

 

Thanks

1 ACCEPTED SOLUTION

@ShAn21 

I tried to get MRVS using this syntax variables.variableSetName , but it returned empty

AnkurBawiskar_0-1741089778632.png

 

1) So let them use Table API for normal variables on RITM table

2) Then inform them to use Table API on sc_multi_row_question_answer table with filter as Parent=RITM SysId

3) Then will get RITM sysId in the 1st call so they can use it in 2nd API call

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

12 REPLIES 12

Ankur Bawiskar
Tera Patron
Tera Patron

@ShAn21 

Don't use TABLE API. It will expose other fields also although it's possible to get the variable data using it.

better to use scripted REST API and ask them to use GET method and send the RITM number

get the variable data, form the response JSON and give that as API response

check this link and enhance

Scripted REST APIs & Retrieving RITM Variables via SRAPI 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi Ankur,

Thanks a lot for getting back. I understand the concern but we are asked to utilize the OOB API as much as possible.

One additional point to the same thing. Is it possible to fetch the Multi row variable set using the OOB API as well? I understand we can use variable.variable_name for standard variable.

 

Thanks

@ShAn21 

you can fetch the MRVS but it will return JSON string as the value for MRVS is actually stored in other table (sc_multi_row_question_answer)

Using Table API will expose all the RITM fields hence I don't recommend

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi Ankur,

That means the consumers need to use the Table API separately twice? For 2 different tables.

 

Thanks