Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Attachment Utils Script Include for API Integrations (Inbound & Outbound)

amrfahmy2
Tera Contributor

 

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.

1 REPLY 1

Rick Kuijpers
Kilo Sage

Thanks, I was able to use your script include for our use cases. Much appreciated!