- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-16-2020 06:33 AM
I have a requirement to download all attachments on a table from a button. I have tried using a UI Action and Processor, via this link
https://www.servicenowguru.com/scripting/download-attachments-zip-file/#comment-34336
But It cannot find the Processor. I believe I read that it is deprecated now as I am in New York.
Does anyone have a current solution to this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-16-2020 01:54 PM
Hi
I got it working as a list UI action on incident table. You'll get one zip for each sys_id passed.
Below is the UI action script:
function downloadAll() {
selSysIds = g_list.getChecked();
sysIdList = selSysIds.split(',');
for (var i=0;i<=sysIdList.length;i++)
{
window.open('/download_all_attachments.do?sysparm_sys_id='+sysIdList[i],"_blank");
}
}
Here's the UI Action screenshot for the setting that I had used:
Thanks & Regards,
Rishabh Jha
Aavenir (http://www.aavenir.com/)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-16-2020 10:11 AM
Ah. I see the OOB Processor. I am able to download from a single record. Is there a way to download from a list of records?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-16-2020 10:27 AM
Hi
I thought you said "I have a requirement to download all attachments on a closed case, on a custom table, from a button.", so assumed that you want to download all the attachments from a record.
You can try it, probably by calling it in a loop, and passing individual sys_ids to the processor.
Thanks & Regards,
Rishabh Jha
Aavenir (http://www.aavenir.com/)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-16-2020 10:33 AM
I apologize. I will change the description. I need to download from multiple records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-16-2020 10:56 AM
I tried the loop but it will only ever download the last attachment in the list of records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-16-2020 11:08 AM
You can wrap the processor call in a script include, and then call that script include from the UI action.
Make the UI action as a "List Choice", so that it'd appear on the list when you select multiple records, and click on "Action on Selected Rows".
You can get the selected record ids in the UI action by using the below snippet:
selSysIds = g_list.getChecked();
sysIdList = selSysIds.split(',');
//call the script include and pass the sysIdList
BTW, I checked that snguru link that you've posted above, and that's also for a single record.
Thanks & Regards,
Rishabh Jha
Aavenir (http://www.aavenir.com/)