Articles in this section

Example: Processing ContentDocuments from Salesforce

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:

A. Set up an export for the ContentDocument link

  1. In Flow Builder, click Add source and select Salesforce from the application list.
  2. Under What would you like to do?, select Export records from the source application.
  3. Select your Salesforce connection, or configure a new connection.
  4. Do not select an existing export. Click Next.
  5. 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.
  6. 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.

B. Create a lookup for ContentVersion data

  1. In Flow Builder, click Add destination/lookup, and select Salesforce from the application list.
  2. Under What would you like to do?, select Look up additional records (per record).
  3. Select your Salesforce connection, or configure a new connection.
  4. Do not select an existing lookup. Click Next.
  5. 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.
  6. 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.

C. Configure the transfer to get the actual BLOB of the document

  1. In Flow Builder, click the + icon next to Destinations & Lookups.
  2. Click Add destination/lookup, and select Salesforce from the application list.
  3. Under What would you like to do?, select Lookup additional files (per record).
  4. Select your Salesforce connection, or configure a new connection.
  5. Do not select an existing lookup. Click Next.
  6. On the Create transfer page, configure the following:
    Transfer.png
    • Name: Enter a meaningful name, such as Get Salesforce BLOB Attachment.
    • sObject type: Select Content Version.
    • Id: Enter {{{data.DocumentID}}}.
  7. Click Save & close.

D. Define response mapping for the lookup

  1. In Flow Builder, click the + icon inside the Lookup bubble:
    ClickinLookup.png
  2. Then, click the results (response) mapping icon between the Lookup and Transfer bubbles:
    ResponseMappingIcon.png
  3. Map the fields as shown:
  4. Click Save & close
Was this article helpful?
1 out of 1 found this helpful

Comments

2 comments
Date Votes
  • I have tried this and continue to get the error "the requested resource does not exist".

     

    0
  • hi Danni Support

    This documentation was created from actual flows built to extract ContentDocuments from Salesforce. Not sure where you are getting the error, but if your connections are setup correctly then these steps should work for you. May be try creating the flow from scratch again?

    0

Please sign in to leave a comment.