This tutorial requires SQL Server Integration Services 2012 or higher with SQL Server Data Tools installed. You need to add them yourself as described in Installation and Requirements.
The tutorial demonstrates how to export Salesforce Attachments into local files.
For the purpose of this tutorial, we create a Devart Salesforce Source and an OLE DB Destination.
|
For this example we need a Salesforce connection for the Devart Salesforce Source. To create a connection to Salesforce, do the following:
The connection for the Salesforce database is now created. |
After the two required connections are created, we can proceed to customizing the data flow components.
First, let's configure the Devart Salesforce Source.
If all options are set correctly, the red marker on the data flow object disappears. Connect the source component with the Derived Column with a Data Flow path and proceed to customizing the Derived Column:
Connect the Derived Column with the Export Column with a Data Flow path and proceed to customizing the Export Column:
Make sure that there are no red error markers on the data flow diagram. Right-click the design area and then click Execute Task. The green marks on the data flow objects indicate that the data flow process is completed successfully: |
Currently, Salesforce uses the Files feature instead of Attachments. These files are stored in different Salesforce objects than Attachments. The most important of them are ContentDocument, storing file name, type, etc., and ContentVersion, storing actual file content. This tutorial can easily be modified to export Salesforce Files instead of Attachments. For this, we only need to modify the query in the Source component and the expression in the Derived Column component. Use the following query for the Source component:
SELECT ContentVersion.VersionData AS Body, ContentDocument.Title, ContentDocument.FileExtension
You may modify the WHERE clause to specify the necessary period, for which to export files. As for the expression of the derived column, you can use the following expression: "C:\\Attachments\\" + Title + "." + FileExtension
Note that if you are going to use already existing components, already configured for Attachments, you may need to open the Advanced Editor for the Derived Column and Export Column components and correct settings on the Input Columns tab. |