
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2015 10:49 AM
I have a need to upload a large number of attachments that were exported from another system.
The files will be attached to the records that they were tied to in the previous system.
I have found the following articles
* http://wiki.service-now.com/index.php?title=AttachmentCreator_SOAP_Web_Service
* http://www.servicenowguru.com/integration/sending-attachment-servicenow/
These solutions are for either loading a single file or loading multiple files to a single record.
Has anyone had any luck with loading many files to many records?
I would be interested in hearing what you used to accomplish this.
Thanks!
https://youtube.com/watch?v=zYi8KhP9SUk
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2015 11:20 AM
Sounds good. This might seem a little silly, but we are actually using pretty much the same general process as the SOAP messages above or John Andersen's REST method Send Attachments using REST... that is we are going to Import the attachments into the ECC Queue. Except we will be doing it without needing to connect to a web service end point. Here's the Transform Map info:
Transform Map Record
Name: <whatever you want to name it>
Source table: <your imported source table created from the csv>
Target table: Queue [ecc_queue]
The rest should be left as defaults
Mapped Fields
Static Fields that are the same for every record imported
agent: "AttachmentCreator"
topic: "AttachmentCreator"
Fields that need to be included in your csv or determined via script
name: "[FILENAME]:[MIME_TYPE_FOR_FILENAME]"
source: "[TABLE_NAME]:[SYS_ID_OF_RECORD_TO_ATTACH_TO]"
payload: "[INSERT_BASE64_STRING_HERE]"
This means that your csv file MUST include:
Filename
Table Name of the record to which the attachment is attached
Sys Id of the record to which the attachment is attached
Base64 encoded string of the data for the attachment
The Mime type, you can either script by looking at the extension of the filename OR you can add a field to your csv and keep the import set simple.
Once the import set drops these records into the ECC Queue, the Attachment Creator (built into the ServiceNow out of 'box') will handle the rest.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2015 09:54 AM
Sure Matt,
These are files that are going to be stored on a LAN drive for import. There are all kinds of doc types (pdf, xls, txt, doc, etc).
We don't have the files on our drive yet, but when we do, there should be a structure / naming convention that will identify the record that the file should be attached to.
Thanks!
https://youtube.com/watch?v=zYi8KhP9SUk

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2015 10:10 AM
Hi John,
I have done something like this. I've to move attachment from another system which contain all types of files. I used MID Server for that. These files are for multiple records.
--
Cheers,
AR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2017 10:04 AM
Hi Akash,
Can you share the scripts and how you did this ? I have 3400 files sitting on a server where the mid-server is installed and can't figure out how to get them uploaded into the sys_attachment table. Each file name has the table name, table sysID and file name as it's name.
Any help would be greatly appreciated.
Regards,
June
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2015 10:48 AM
Hi John,
When faced with this situation, I have used a few different techniques:
1. Mid Server as Akash points out, techniques for this approach can vary
2. Use Python, Perl, Node.js, or a scripting language you are familiar with, or Apple's Automator to compress the files and data into a csv (one of your fields will be a base64 encoding of the attachment file). Then I use Import Sets to import.
3. Use Python, Perl, Node.js or a scripting language you are familiar with to iterate through the files and make a single Web Service call for each using the methods in the links you mentioned above
I prefer #2 because it breaks up the process into 2 chunks, building a csv table of attachments and importing the csv. This allows me to create a standard csv format so I can reuse the same Import Set Transform Maps in ServiceNow (I do a lot of data uploads). That way, the only thing I have to customize for each data import is the transformation of the attachments into a compressed csv file.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2015 11:02 AM
OK I am going with option 2. Thanks. I have a small CSV comprising of 2 files created and have successfully imported them to an import set. For this test, I am attaching it to a specific incident (listed as source).
Can you go into some detail of what the transform map looks like for this?
Thanks!
https://youtube.com/watch?v=zYi8KhP9SUk