- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 06-23-2021 11:06 PM
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
- 7,678 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Can We update name of downloaded zip file?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Processors are deprecated, you have to use Scripted REST APIs, see https://docs.servicenow.com/en-US/bundle/tokyo-application-development/page/script/processors/concep...
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
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.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Sai Kumar,
Can we pass multiple Sys_ids into the URL will that work?
Regards,
Saurabh