- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2025 02:21 AM
Hi people
Need a solution regarding how we can convert attachments to base64 and sent it via API.
So, basically I have created a catalog and have been sending the info added onto the fields from the catalog via API to 3rd party(all this done using flow).
- Now, I need to send the attachments as well through the same API trigger. Currently I have been using "LookUp Record" step, attaching screenshot.
- But the issue is, say we have 2 attachments, the payload goes twice. As we have "For Each", but I need it to be sent in one trigger. Something like this:
<attachments>
<z_attachment>
<base64>{base64_value}</base64>
</z_attachment>
<z_attachment>
<base64>{base64_value}</base64>
</z_attachment>
</attachments>
- I was able to sent 'hash value', but need to send as base64. How?
I would appreciate your help!! Let me know if further details are required.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2025 04:37 AM
then here is the alternative for scoped app
var gr = new GlideRecord('sys_attachment');
gr.get('3fd6017407d3dc50540bf2508c1ed027');
var sysAtt = new GlideSysAttachment();
var base64Data = sysAtt.getContentBase64(gr);
gs.info(base64Data);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2025 04:37 AM
then here is the alternative for scoped app
var gr = new GlideRecord('sys_attachment');
gr.get('3fd6017407d3dc50540bf2508c1ed027');
var sysAtt = new GlideSysAttachment();
var base64Data = sysAtt.getContentBase64(gr);
gs.info(base64Data);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader