Form button to download all attachments for all related records of REQUEST
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-04-2022 02:50 AM
can we create a form button on the REQ form that will download anything attached to the REQ, any related RITM and any SC_TASK beneath those RITM
I have tired with below script in UI action and i can download the attachment from request table or its related RITM or SC_TASK, i cannot download all attachment at once
can anyone help with this issue !
gs.setRedirect('/download_all_attachments.do?sysparm_sys_id=' + current.sys_id);
gs.addInfoMessage('hi');
var gr = new GlideRecord('sc_req_item');
gr.addQuery('request', current.sys_id);
gr.query();
while (gr.next()) {
gs.setRedirect('/download_all_attachments.do?sysparm_sys_id=' + gr.sys_id);
var grm = new GlideRecord('sc_task');
grm.addQuery('request', current.sys_id);
grm.query();
while (grm.next()) {
gs.setRedirect('/download_all_attachments.do?sysparm_sys_id=' + grm.sys_id);
}
}
Regards
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-04-2022 05:34 AM
Hi
Thanks for the reply. But again facing the same issue that only the request table attachment is getting downloaded. The requirement to download its related RITM, task table attachment fails.
Referring to the already existing threads, tried with window.open, as mentioned by you but the same issue prevails.
Is any other modifications needed? Kindly help.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-04-2022 05:42 AM
Hi
Thanks for reply. But still facing the same issue that only the request table attachment is getting downloaded. The requirement to download its related RITM, task table attachment fails. Referring to the already existing thread, tried with window.open as mentioned by you, still the same issue prevails.
Is any other modifications needed? Kindly help !
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-05-2022 07:37 PM
Hi,
what debugging did you perform in the script I shared?
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
ā07-04-2022 10:37 PM
Hi
I have tried the code, but only sc_request table attachment are getting downloaded its not gliding into sc_task table and sc_req_item table, is any other suggestions to get glide into various table to download all attachments.
Thanks & Regads,
Arunkumar P