- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2022 01:59 AM
Hi community!
I would like to set up a UI Action that downloads all attachments. I know there is a functionality that does this downloading all files as a ZIP file. But that's not what I want. I need every file downloaded as is without having it in a ZIP file.
Is that possible and how would I do that?
Thanks!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2022 03:43 AM
Hi,
can be done
1) create a form UI action which is client side
2) Client checkbox - true
3) Onclick - downloadAll()
4) Script:
Ensure your pop-up blocker is allowing the new tabs then only the files would be downloaded
function downloadAll() {
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_sys_id", g_form.getUniqueValue());
gr.query();
while(gr.next()) {
window.open('/sys_attachment.do?sys_id='+gr.sys_id,"_blank");
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2022 02:08 AM
Hi,
so every single file should be a zip file?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2022 02:11 AM
Hi,
thank you for taking time to answer my request.
And sorry, that's not what I meant. Let's assume I have 2 *.jpg and 1 *.pdf file attached to a record. I want them to be downloaded as 2 *.jpg and 1 *.pdf files and not as 1 *.zip.
I hope that clarifies my request.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2022 02:56 AM
Hi,
Still not clear.
2 files sample.jpg and inc.pdf -> should it be merged into 1 zip file?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2022 03:01 AM
Hi,
not sure how to describe it more detailed. I will try:
2 files sample.jpg and inc.pdf -> click "Download All" button -> do NOT merge files in a ZIP, instead simply download both files
After the download the local download folder on my computer should contain both sample.jpg and inc.pdf.