Script to export reports to individual XML Files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2020 02:48 AM
Hi ,
We have a requirement to delete old unused reports (10000+). But Management wants to keep the back up of old reports in the individual XML files, lets say if 100 reports are there , they want to have 100 xml files of each report. Do we have any bulk export mechanism or any scripting to keep take them all individually and save them with their respective names, instead of taking all into XML.?
Regards
Madhu
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2020 02:51 AM
Hello MAdhu,
Please go through the document provided by ServiceNow for exporting Bulk Data:
Please Mark it helpful/correct if my answer helps in any way to resolve your query.
Reach out to me if any more help required.
Regards
Yash.K.Agrawal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2020 02:57 AM
Hello Yash,
Thanks for your response. But the provided links does not help as what we are looking is to export them as individual files not into single file.
Regards
Madhu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2020 03:09 AM
Hi Madhu,
one thing you can try is this using your javascript executor
when it runs it will ask you whether to save or open the file.
you try this in chrome so that it auto-downloads
Short cut - Ctrl + Shift + Alt + J
downloadFiles();
function downloadFiles(){
var sysIdArray = ['sys_id1','sys_id2']; // give here those 100 record sys_ids
for(var i=0;i<sysIdArray.length;i++){
var gr = new GlideRecord('tableName');
gr.addQuery('sys_id', sysIdArray[i]);
gr.query();
if(gr.next()){
var url = '/tableName_list.do?XML&sysparm_query=sys_id=' + sysIdArray[i];
window.open(url);
}
}
}
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
‎11-26-2022 06:10 AM
When I tried to do it
var url = '/tableName_list.do?XML&sysparm_query=sys_id=xxxxxxx';
window.open(url);
Chrome open the xml file in a new tab instead of asking me to download it