Can we include attachment on the import set record to the target record?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2018 07:31 PM
How do we include/exclude attachment from the import set table to the target table during transform?
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2018 07:57 PM
Hi Edgar,
By default, attachments are not included when you import the data via Import set Tables. However, you can use the Attachment API to include attachments.
Reference:
https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/integrate/inbound_rest/reference/r_AttachmentAPI-POST.html
https://community.servicenow.com/community?id=community_question&sys_id=970903e1db5cdbc01dcaf3231f9619ce
Thanks,
Pradeep Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2018 09:54 PM
You can use the attachment API in a script.
Or you can do it via script by inserting into ecc queue:
Convert your attachment to base64
var inc = new GlideRecord('incident');
inc.query();
while(inc.next()){
var ecc = new GlideRecord('ecc_queue');
ecc.initialize();
ecc.agent = 'AttachmentCreator';
ecc.topic = 'AttachmentCreator';
ecc.name = 'file_name.xls:application/vnd.ms-excel' // or whatever the file name is + its content-type
ecc.soruce = 'incident:' + inc.sys_id;
ecc.payload = '<attachment base 64>';
ecc.insert();
}
Regards,
Sachin