How does one send files/attachments to an external system?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
We have a business need where we may need to send files in our ServiceNow instance to a different system. I'm not finding any documentation or resource that does this.
Example use cases:
1`. External system sends a request to ServiceNow intsance for attachments in recordA
2. ServiceNow instance sends an attachment in recordA to external system
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
For Scenario 1 (The Pull), the external system should use the standard ServiceNow Attachment API; they must first query the sys_attachment table to find the specific file ID for the record, and then call the endpoint GET /now/attachment/{sys_id}/file to download the binary.
For Scenario 2 (The Push), you need to use the RESTMessageV2 API in a script (or Integration Hub in Flow Designer). The critical method for this is setRequestBodyFromAttachment(attachmentSysId), which streams the file data directly from the ServiceNow record into the body of your outbound POST/PUT request.
ɪꜰ ᴍʏ ᴀɴꜱᴡᴇʀ ʜᴀꜱ ʜᴇʟᴘᴇᴅ ᴡɪᴛʜ ʏᴏᴜʀ Qᴜᴇꜱᴛɪᴏɴ, ᴘʟᴇᴀꜱᴇ ᴍᴀʀᴋ ᴍʏ ᴀɴꜱᴡᴇʀ ᴀꜱ ᴛʜᴇ ᴀᴄᴄᴇᴘᴛᴇᴅ ꜱᴏʟᴜᴛɪᴏɴ ᴀɴᴅ ɢɪᴠᴇ ᴀ ᴛʜᴜᴍʙꜱ ᴜᴘ.
ʙᴇꜱᴛ ʀᴇɢᴀʀᴅꜱ
ꜱʀᴇᴇʀᴀᴍ