How to upload and retrieve Attachments to and from salesforce.com using Salesforce Plugin

How to upload and retrieve Attachments to and from salesforce.com using Salesforce Plugin

book

Article ID: KB0081357

calendar_today

Updated On:

Description

Steps to upload and retrieve Attachments to and from salesforce.com using Salesforce Plugin:

Issue/Introduction

How to upload and retrieve Attachements to and from salesforce.com using Salesforce Plugin

Environment

All Environment

Resolution

You can use Salesforce Plug-in "Salesforce-Create-All" palette to upload the attachment files to Salesforce.com. Please refer to following steps:

1). Choose "Attachment" as the schema type for sObject for "Salesforce-Create-All".

2). Specify the required parameters "Parentld", "Name" and "Body". "Parentld" can be mapped from the palette "Salesforce-Query-All". "Name" is the display name on Salesforce side. "Body" is the attachment body which should be a binary type. For detail parameters information, refer to the Salesforce document .http://www.salesforce.com/developer/docs/api/

3). In the sample project we use "Read File" palette to read a file, for example a .png file, and send it to an Account's record as attachment.

For insert attachments, you can use "Salesforce-Upsert-All" palette and follow the similar way of upload to do it.

For retrieve attachments, as far as we know there is no specific settings for retrieving attachments. You can use "Salesforce-Retrieve-All" palette to do it. Steps for retrieving attachments are as below:

1. You can create a Salesforce Query All activity to get the ids you want to retrieve attachment. In the input, you can set 'queryString' as, for example, "Select Id, Name from Attachment".

2. Then you can create a Salesforce Retrieve All activity to retrieve the attachment. In the input, you can set 'fieldList' as, for example, "Id,Name,Body". And the 'sObjectType' should be set as "Attachment". Then map the ids from Salesforce Query All output.

3. Kindly note that by default the retrieved type of Body field is Base64. For details of Fields and Supported Calls of Attachment, please refer to the Salesforce developer documents. https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_attachment.htm

4. Retrieving Notes from a record is similar with retrieving attachment. For details of Fields and Supported Calls of Attachment, you can refer to the following Salesforce developer documents.
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_note.htm