Attachment Utils Script Include for API Integrations (Inbound & Outbound)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
When working on ServiceNow integrations, attachments are often one of the most painful parts to handle consistently.
Across different projects, I kept running into the same challenges:
Reading attachments and sending them to external systems
Receiving attachments from inbound APIs and saving them on records
Validating file count, size, and content type
Avoiding duplicated attachment logic across Scripted REST APIs, Business Rules, and Flows
To solve this, I built a small reusable Attachment Utility that centralizes all attachment-related logic and can be reused across inbound and outbound integrations.
The utility supports:
Converting attachments to Base64 for outbound REST APIs
Decoding Base64 content and attaching files for inbound APIs
Centralized validation for file count, size, and content type
Clean and consistent attachment handling across integrations
I’ve attached the utility as an attachment to this post so it can be reviewed or adapted based on different integration needs.
Happy to hear feedback or discuss other approaches people are using for attachment handling in ServiceNow integrations.
