In the Salesforce API, the ContentDocument object represents a document that has been uploaded to a library in Salesforce CRM Content or Salesforce Files. In this example, we'll explain how to export opportunity attachments from Salesforce as the first flow in an integration with NetSuite. We'll set up the following flow configuration to extract data from the ContentDocument:
-
In Flow Builder, click Add source and select Salesforce from the application list.
-
Under What would you like to do?, select Export records from the source application.
-
Select your Salesforce connection, or configure a new connection.
-
Do not select an existing export. Click Next.
-
On the Create export page, configure the following:
-
Name: Enter a meaningful name, such as Export ContentDocument link.
-
SOQL query:
SELECT Id, LinkedEntityId, ContentDocumentId, SystemModstamp FROM ContentDocumentLink WHERE LinkedEntityId IN (SELECT Id FROM Opportunity WHERE NetSuite_Opportunity_Id_c!=null)
-
Export type: Select whether to export all data, or another option based on your use case.
-
-
Click Preview to see the data that will be exported. When you are ready to continue with the next part of the flow configuration, click Save & close.
-
In Flow Builder, click Add destination/lookup, and select Salesforce from the application list.
-
Under What would you like to do?, select Look up additional records (per record).
-
Select your Salesforce connection, or configure a new connection.
-
Do not select an existing lookup. Click Next.
-
On the Create lookup page, configure the following:
-
Name: Enter a meaningful name, such as Get ContentVersion Object.
-
SOQL query:
SELECT Id, VersionData, title, PathOnClient FROM ContentVersion WHERE ContentDocumentId = '{{{data.ContentDocumentId}}}'
-
Export type: Select whether to export all data, or another option based on your use case.
-
-
Click Preview to see the data that will be exported. When you are ready to continue with the next part of the flow configuration, click Save & close.
-
In Flow Builder, click the + icon next to Destinations & Lookups.
-
Click Add destination/lookup, and select Salesforce from the application list.
-
Under What would you like to do?, select Lookup additional files (per record).
-
Select your Salesforce connection, or configure a new connection.
-
Do not select an existing lookup. Click Next.
-
On the Create transfer page, configure the following:
-
Name: Enter a meaningful name, such as Get Salesforce BLOB Attachment.
-
sObject type: Select Content Version.
-
Id: Enter {{{data.DocumentID}}} .
-
-
Click Save & close.