How to modify/update a large XML file and then import?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2020 11:23 AM
Hi Experts,
I have an XML file of KB articles size around 300-400 MB.
I want to modify few field values from the XML file(eg. created by to XYZ, Created on to current date/time, view count to 0, etc).
Due to size of the file it's impossible to modify the field values manually and import.
I want to know is there any way I can import the XML by modifying the fields in it.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2020 11:28 AM
Hi Jay,
You can use background script
var gr = new GlideRecord("kb_knowledge");
gr.addQuery("sys_id", "<sys id of the KB article>");
gr.query();
if(gr.next()) {
gr.sys_created_by = "<sys id of the user>";
gr.sys_created_on = gs.nowDateTime();
grsetWorkflow(false);
gr.autoSysFiields(false);
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2020 11:41 AM
Hi this might work for a single KB article. There are many KB articles.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2020 11:45 AM
You can update the query as per your requirement

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2020 11:30 AM
First, you should modify data in servicenow UI forms before export.
After modification is done, you can use export, import functionality to export, import data in JSON format.
https://developer.servicenow.com/blog.do?p=/tags/export-set/
If you still need to export in XML format, then you need to break up XML
Regards,
Sachin