Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Creating attachments using Web Services - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Creating attachments using Web Services
KB0546294

Creating attachments using Web Services


17557 Views Last updated : Jul 19, 2023 public Copy Permalink English (Original)
  • English (Original)
  • Japanese
KB Summary by Now Assist

Issue

This article addresses the following two needs:

  • create attachments in ServiceNow through a web service request
  • determine if there are limits on attachment size while sending a large payload as an attachment

Resolution

Follow the instructions in Attachment Creator Webservice in the ServiceNow product documentation.

The article is written for SOAP web services, but the same principle can be used with either REST API or JSONv2. In those cases, send a POST request to the following URLs:

  • REST: https://<instance-name>/api/now/table/ecc_queue
  • Headers for REST:
    • Accept = application/json
    • Content-Type = application/json
  • JSON v2: https://<instance-name>/ecc_queue.do?JSONv2?sysparm_action=insert
    • Headers for JSONv2 not required
    • Use a request body of:
      {"agent":"AttachmentCreator","topic":"AttachmentCreator","name":"<FileName>:<Format>","source":"<targetTable>:<SysId>","payload":"<base64encodedStr>"}
      Example:
      {"agent":"AttachmentCreator","topic":"AttachmentCreator","name":"john1.txt:text/plain","source":"incident:e886867e1b9b2050ac4475561a4bcb34","payload":"SSB3b25kZXIgaWYgc2hlIGtub3ducyB3aGF0IHNoZSdzIGRvaW5nIG5vdy4K"}

 

Related Links

Business rules and sensors are defined on the ECC Queue to act on records inserted with the AttachmentCreator agent. Sending a request to the ECC Queue as described above through any web service creates the attachment.

Attachment creation is limited by:

  • The size of the payload field
    • The payload field can take values up to 16MB so it is usually okay to send a base64 encoded payload with a size up to max 16,777,215 bytes(=15,9MB)
    • If you are using SOAP to do the insert, the payload file size limitation is overridden by the glide.soapprocessor.large_field_patch_max property
  • The max attachment size property
    • To check the max attachment file size property, follow the instructions in Limiting Attachment File Size in the ServiceNow product documentation
  • The size of the request body
    • If the body is too big to process within the defined timeout period, the entire transaction can get canceled and cause a timeout response. With the out-of-box HTTP timeout setting, an attachment with a size of 8 MB should still be attached successfully.

The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.