Importing Binary Data from ServiceNow to Access
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2024 07:12 AM
I have been tasked to create a disaster recovery database in the event that ServiceNow (SNOW) goes down. I did an XML export of a SNOW knowledge base and was successful in importing it into MS Access. I was even successful in determining the relationships between article and attachment as illustrated in the below entity relationship diagram.
Since XML is text, much like HTML, I do not know how to export the binary data such as attachments and in-line images. As you can see from the "knowledge form" I created (see below), I can bring in the article text formatted and even the related attachment fields, but not the binary attachment itself, the field where it should display is blank. Does anyone know how to export that data so I can reference it in the Access database?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 06:20 AM
You can raise a case with ServiceNow support for best possible way to retreive KB PDF in bulk.
Copying/Storing data only will not help you to generate PDF outside of ServiceNow.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 05:34 AM
ServiceNow didn't have a solution, which is why I reached out to this forum. I'm surprised no one else has experience doing this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 05:45 AM - edited 05-14-2024 05:45 AM
that's true, the whole knowledge mgmt application is not just a single table data, it has relationship to other tables and that relationship key is sys_id of related record and only ServiceNow process engine can convert that data into meaningfull KB article otherwise it become just data stored in database. We can store the data but we can't add the same logic to convert in PDF outside of ServiceNow.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 06:25 AM
The export of the KB Article should already contain all the information of the attachment file(s).
In the xml you can see all the base64 encoding if the KB Article has attachments.
Looking closely at the XML each section for an attachment is defined by the sys_id and position. It has a position because ServiceNow stores attachment files in 4k chunks.
Each chunk has a position designating how it should be put back together.
@vab_13wrote a great article on it.
https://www.servicenow.com/community/itsm-articles/attachments-in-servicenow/ta-p/2305632
In short it states to
- base64_decode each chunk
- It will build a gzip archive
- gunzip this archive
- file attained
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2024 08:22 AM - edited 05-15-2024 08:23 AM
I've seen that article. I have the XML export but there's no binary data for me to reference. I even made sure the field type in Access was an OLE Object (aka binary) field and no luck. It's just blank. I am trying a different method, but I'm running into authentication issues with Okta, but for that I reached out to the respective teams where I work to get that resolved. Plus, I'm not thrilled with the idea of hard coding an ID/PW so I am looking at other options.