Getting attachments via api and send them to Salesforce
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2018 08:05 AM
Hi,
I work on an integration between ServiceNow and Salesforce using Dell BOOMI.
I want to get Attachements from ServiceNow and send them to Salesforce.
As described in this link: How to retrieve an attachment from service now ... | ServiceNow Community , ServiceNow store attachments zipped, splitted in multiple chucks and then encoded in Base64.
On ServiceNow I can query sys_attachment table and then I can query sys_attachment_doc table where sys_attachment = sys_id from the previous call.
The result is a list of sys_attachment_doc records which have to be
- Base64 decoded
- combined in one document and send them to Salesforce.
- Unzipped
- Send the result to SF
Currently I am able to get one document combined with all data but not decoded neither unzipped.
When I add the Base 64 Decode or the unzip step I get errors
When I remove the Base64 Decode step, the file is created in SF but it is corrupted.
When I leave the Base64 Decode step I get an error:
Test execution of [SNOW->SF] Update Case From Incident completed with errors. Embedded message: Unable to store data, error copying stream.; Caused by: Failed generating xml document; Caused by: Invalid white space character (0x1b) in text to output
the error occured at the decoding step.
Is there any other way to receive the whole attachment content together?
Any help will be appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2018 11:44 AM
I suggested you two options: 1) GlideSysAttachment and 2) Attachment API.
Attachment API are pure REST API and can be used "from outside". I suppose that HTTP GET request to /now/attachment/<attachment sys_id>/file is what you need to use. I recommend you to watch the video from the page Attachment API or the same from Youtube: see here