Issue in resolving a SRAPI endpoint to a CSV file

Shalaka Vaze
Tera Contributor

Hello Experts,

We have a requirement where user should be able to directly download selected records from the list view of a table into a CSV file via a UI button on the list banner. This is implemented via a Scripted REST API(GET). On clicking the UI button, the invoked script include makes the API call and returns the endpoint URL. This returned URL is then opened in a new window via the UI action and the CSV file gets downloaded.

 

We are passing the selected sys_ids in the API parameter. This is working fine as long as the selected record count does not exceed 20. When it does, the URL is shortened (sysparm_tiny) and the desired file is not generated. If anyone has come across resolving such an issue please guide on how to overcome this limitation. 

5 REPLIES 5

luffy3478
Tera Guru

Hi @luffy3478 ,

 

Thanks for responding. The data I am trying to extract resides in a json type field. So I cannot just make use of that column since the key value pairs to be extracted depends on the record type. Please refer to the below table. So, depending on the questionnaire type user selects in the list view, the relevant questions would be extracted by a function. For eg- Type A(question 2 and 4) Type B(question 1 and 3).
The data extraction and formatting into a CSV is done via that function . Its called in the SRAPI for the passed sys_ids. When this endpoint is hit, the CSV file will be downloaded. 

Questionnaire IDQuestionnaire TypeData
ID00001Type A

{
"Question1":"Answer 1",
"Question2":"Answer2",

"Question3":"Answer 3",
"Question4":"Answer4",
}

ID00002Type B

{
"Question1":"Answer 1",
"Question2":"Answer2",

"Question3":"Answer 3",
"Question4":"Answer4",
}

Got it. In that case can you try storing these sys_id's in a separate table and then fetch the data from that record in SRAPI?

It will complicate the existing design.