- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2018 02:54 AM
Hi Experts,
In Knowledge Management, I am trying to read the attachments. When I pull a dump in XML and try to decode the
attachments it works fine. But when I use the REST API and pull the attachments, I am not able to decode the file it
throws an error. When I try to compare the Base64 String in XML and REST API, both are different. Kindly let me know
how to get this issue resolved.
Thank you,
Sriram.
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2018 11:27 PM
Hi Sriram,
Yes the actual data resides in sys_attachment_doc but not as whole but in chunks; so you won't get complete set of data from that table from single record.
https://snprotips.com/blog/2016/2/25/understanding-and-using-glideattachment
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
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
‎08-25-2020 02:23 AM
I recommend using the API, not any kind of Java code. This is the link to the scoped API (search for "attach"):
https://developer.servicenow.com/dev.do#!/reference/api/orlando/server/no-namespace/c_CertificateEnc...
there is also a global API as well as a REST API (https://developer.servicenow.com/dev.do#!/reference/api/orlando/rest/c_AttachmentAPI) for attachments.
Kind regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2020 03:40 AM
Hi Sebastian,
I want to download attachments in a zip file according to the RITM no associated to it. I don't want to go with ui action option.
I tried to use attachment API but couldn't find a way to download the attachments. All i was able to see was metadata.
I want the exact attachment that is attached to the RITM
Example; if i have 20 RITMs. If i hot an API, then 20 zip files should be created locally storing the respective attachments.
Pls help.
Regards,
Nikita

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2018 10:49 PM
Hi,
sys_attachment_doc is storing the attachment in base64 encoded chunks. So there is no real way to get the complete attachment except using the API. Sorry.
Kind regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2020 10:30 PM
Can someone help me with converting plain text content to base64encoded string. I need to convert text to encoded format write it into PDF with GlideSysAttachment API function :
writeBase64(GlideRecord now_GR, String fileName, String contentType, String content_base64Encoded)
Can't find any documentation or example to do so.