The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Access multi-row variable set from RITM using Rest API

竜太畠
Tera Contributor

I am investigating how to retrieve ticket information created in the service catalog from an external system (Python).

I understand that by specifying “variables.variable_name” in the sysparm_fields of the sc_req_item table API, values for variable information other than MultiRow can be obtained in the format below.

“variables_variable_name”: “The selected value displayed on the screen


If you want to acquire MultiRow data, aside from accessing individual related tables through Sys_id as shown below to obtain data, is there any good solution available at the moment?

<MultiRow relationship table>
sc_req_item、sc_multi_row_question_answer、sc_item_option_new

 

If we use JSONv2, I thought we could also obtain values for MultiRow. However, if many API executions are expected, there is a concern that this may affect the responsiveness of user screen interactions, so I believe it should be viewed as a non-recommended approach.Is my understanding correct?

Solved: Re: Rest API vs JSONv2 - ServiceNow Community


<Similar questions from 2020>

Solved: Access multi-row variable set from RITM using Rest... - ServiceNow Community

If the situation has not changed since 2020, I understand that I need to run an API on the “MultiRow relationship table” mentioned above to format the data.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@竜太畠 

you won't get MRVS data using the OOTB Table API on sc_req_item as MRVS data is stored in other table

Another way is this to use Scripted REST API

How to fetch Multirow variables on RITM/SCTASK using REST api 

Another way is to use table API on Multi Row Question Answer [sc_multi_row_question_answer]

check how it's done

Example below

AnkurBawiskar_1-1750771196948.png

 

AnkurBawiskar_2-1750771197032.png

 

AnkurBawiskar_3-1750771196904.png

 

 

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

8 REPLIES 8

竜太畠
Tera Contributor

Hi,@Ankur Bawiskar -san

Thank you for the useful information. I have one question.

When dealing with a reference table in MultiRow items, using the API specification you shared as a reference, it seems that the sys_id information from sys_user is output in value.
This is a capture of PDI.

_2-1750842132845.png

 



If the sys_id of the reference table is output to the Value in this way, please let me know if you know of a good and easy way to get the value other than obtaining the reference table information from the reference field of the “item_option_new” table and searching by sys_id to get the value.

 

@竜太畠 

that's how reference variables are stored for MRVS in the backend table

It stores sysId

if 3rd party is ok with that then fine, if not then you can use scripted REST API and send the JSON in whatever format they want with the display value.

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

竜太畠
Tera Contributor

@Marcos Kassak -san @Ankur Bawiskar -san

Thank you for both of your responses. I will consider how to take action based on the information provided. 

Not a problem @竜太畠 - that was a good question indeed. Regardless of the solution, monitor the Transactions table for APIs to check if you're experiencing high usage on your instance, which could lead to performance issues as this solution scales.

 

Have a great week ahead!