How to export attachments of multiple records at once

Jessica1307
Tera Expert

I want to download some attachement of multiple records at once, Is this possible?

1 ACCEPTED SOLUTION

try this

function downloadAll() {
    var selectedSysIds = g_list.getChecked();
    var arr = selectedSysIds.split(',');
    for (var i = 0; i < arr.length; i++) {
        alert(arr[i]);
        var gr = new GlideRecord("sys_attachment");
        gr.addQuery("table_sys_id", arr[i]);
        gr.query();
        if (gr.next()) {
            alert(123);
            var url = '/sys_attachment.do?sys_id=' + gr.sys_id;
            g_navigation.open(url, '_blank');            
        }
    }
}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

19 REPLIES 19

Frankline Jero1
Tera Contributor

Hi Yang,

From list view , right click on the column name and navigate it to export. This will export all the filtered records. In the below case it is all the active incidents.

Hope this answers your question.

Tony Chatfield1
Kilo Patron

Hi, there is no OOB or simple solution to this, perhaps you can share clear details of your use case\business requirement, so that the forum is in a better position to advise.

Hi , I thought maybe UI action can do this, I want to click 'download' ui action to download all attachments of selected records, but It did not work. Do you have some advice? Thank you! find_real_file.png

Aman Kumar S
Kilo Patron

Hi @Yang Wu 

Refer to below link:

I want to download selected files from incident instead of all could you please help with the script

 

Feel free to mark correct, if your issue has been resolved, so it ends up in solved queue.

Will be helpful for others looking for the similar query.

Best Regards
Aman Kumar