How to download files with scripts ?

Fagi
Tera Contributor

Thanks again for your help.
We would like to create a UI Action in GlideReocrd that will download a CSV file when a button is pressed in the database view list screen.
When the UI Action button is pressed, the Script Include is called and the file can be downloaded according to the code in the Script field of the Script Include.
I was going to use the code in the following image as a reference, but the code in this image attaches the file to the record at the end.
As I mentioned above, I would like to download the file without attaching it.
If possible, I would like to use this code as is and replace the attached part with a direct download code, is this possible?
The premise is that I want to output the header of the CSV file with column labels, while leaving the header of the csv header as column names in the Export Import module settings, so I specify the header directly in the script.
I would be grateful if you could provide me with some guidance.
Thank you very much in advance for your help.

スクリーンショット 2022-10-04 184301.png

1件の返信1

Luke Van Epen
Tera Guru

Do you have a reason for why you can't use the normal Export List functionality described here? 

https://docs.servicenow.com/bundle/tokyo-platform-administration/page/administer/exporting-data/conc... 

 

If the Column Headings are a concern, you can export to Excel then just change the file type to CSV afterwards