Issue in resolving a SRAPI endpoint to a CSV file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2024 09:36 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2024 03:19 PM
can you try using CSV processor instead of SRAPI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2024 11:53 PM
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 ID | Questionnaire Type | Data |
ID00001 | Type A | { "Question3":"Answer 3", |
ID00002 | Type B | { "Question3":"Answer 3", |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2024 12:34 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2024 02:59 AM
It will complicate the existing design.