Sai Kumar B
Mega Sage
Mega Sage

Do you know?

By OOTB we have a Java class processor that downloads the attachments with one click 

  • System definition-> Processors -> DownloadAllAttachmentsProcessor
  • Just copy the path of the processor and append it to the URL

For example

You have an Incident record with multiple attachments, the URL should be 

'/processor_path.do?sysparm_sys_id=incident sys_id' , Here processor_path should be be download_all_attachments as per the above mentioned processor record

Sample URL : '/download_all_attachments.do?sysparm_sys_id=incident sys_id' --> This downloads all the attachments related to the record as ZIP file.

You may get a possible query, how I can restrict downloading the single attachment as ZIP with the above URL?

Just get the count of the attachments with the script using GlideAggerateg() and based on the count set the URL dynamic

var URL = '/sys_attachment.do?sys_id=sysID' //First set the basic URL
if(count>1){
URL = '/download_all_attachments.do?sysparm_sys_id=incident sys_id ';
}
action.setRedirectURL(URL) (or) window.open(URL) (or) return URL (or) gs.setRedirectURL(URL) --> The navigation method depends where you use the URL(Client side/Server side/VA etc..)

Note: Corrections are welcome 🙂

Happy Learning!

Best regards,
Sai Kumar

 

 

 

Comments
Inactive_Use693
Kilo Expert
Good knowledge sharing
Pooja Mahajan
Tera Contributor

Can We update name of downloaded zip file?

Sai Kumar B
Mega Sage
Mega Sage

@Pooja Mahajan I believe We don't have that option in the OOB processor but you can create a custom processor and there you can add a new parameter to rename your file name. refer to the following blog - Download Attachments as a ZIP File

 

MarcB1
Tera Guru
bhaveshbawa
Tera Contributor

Can we have custom zip file name?

Can we get in normal folder rather than in zip?

Requirement is that, Lets say 5 attachment are there in an single incident. Download all in a single folder with custom name.

Saurabh Singh5
Tera Expert

Hi Sai Kumar,

 

Can we pass multiple Sys_ids into the URL will that work?

 

 

Regards,

Saurabh

Version history
Last update:
‎06-23-2021 11:06 PM
Updated by: