Attaching a file to a record within the ServiceNow interface is a trivial task.  However, many customers have found it necessary to send an attachment via web services to Service-now.  This need is usually spawned from an integration with a 3rd-party product.  The SOAP Attachments update set is the perfect solution for this problem.

The update set has now been added to the latest release of ServiceNow as part of the core code.  You will only need this update set if you’re on an older build.


The attachment creator allows a third-party user to send base64 encoded binary (or ASCII) data via SOAP and have it attached to any table within ServiceNow. The solution is actually quite simple. You need to send a web service message to the ecc_queue.  You can access the WSDL and SOAP endpoint here:

WSDL:https://instance_name.service-now.com/ecc_queue.do?WSDL
Endpoint:https://instance_name.service-now.com/ecc_queue.do?SOAP

The values for your fields will need to be as follows:

agentAttachmentCreator
topicAttachmentCreator
nameproblem_data.xls:application/vnd.ms-excel
sourceincident:a7e6c1840a0a3c1e018ac300f684be29
payloadbase64 encoded binary (or ASCII) data

Using the data specified above, the resulting SOAP message will attach the problem_data.xls file to the incident that has the sys_id of a7e6c1840a0a3c1e018ac300f684be29.  The SOAP message would look like the following:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ecc="http://www.service-now.com/ecc_queue">
<soapenv:Header/>
  <soapenv:Body>
    <ecc:insert>
      <agent>AttachmentCreator</agent>
      <name>problem_data.xls:application/vnd.ms-excel</name>
      <payload>AAAAIGZ0eXBxdCrG[..truncated..]</payload>;
      <source>incident:a7e6c1840a0a3c1e018ac300f684be29</source>
      <topic>AttachmentCreator</topic>
    </ecc:insert>
  </soapenv:Body>
</soapenv:Envelope>
Remember, just like any of the ServiceNow web services, you will need to use basic authentication and specify a user in your instance that has rights to create attachments to the target record.

Prerequisites:

  • None

Related Links: