1

How do you upload a file to an external data source (e.g. Sharepoint, Google Drive, etc) in Salesforce via Files Connect? Is this even possible. I've read the Salesforce articles, I've watched a number of videos (from Laurent Kubaski). And they end up just being a way view files stored on the external data source with no way to upload or even edit.

TL;DR;

I'm hoping to be able to upload a file to Sharepoint/GoogleDocs/etc via Salesforce (from an Upload button on the Files tab/page or the RestAPI or even Apex) so that the file gets inserted/uploaded into the external system and a ContentVersion record gets created from that process, linked to that newly created external document.


The closest I've seen to anyone doing this is in this post (Sharepoint Files Connect identifiers in Content Version Object) where he says:

After uploading a Sharepoint file via Salesforce Files Connect, i see a record gets created in Content Version object.

But he doesn't mention how he did it.

The only other articles that even come close are similar to this article (Convert GoogleDoc records to Salesforce Files) where he's adding ContentVersion records linking to existing file in Google Docs but he's doing this because of an apparent change in the Google API:

After April 2015, [...] Salesforce changed the integration citing changes to Google’s API. You can now only create bookmarks to the URLs of Google Drive files this way.

So, is it even possible to upload a file in Salesforce that goes directly into an external data source, without:

  1. having two copies of the file data/content (one in Salesforce and the other in the external system)
  2. having to manually insert the file into the external system via a RestAPI call (whatever) and then querying the info of newly inserted file, from the external system, just to add a link in Salesforce.

I've tried to use the Salesforce Rest API to insert (POST) a file into the external data source but it fails with Required fields are missing: [ExternalDocumentInfo2] which is the ID of the file in the external system.

{
"ExternalDataSourceId": "<ExternalDataSourceId>",
"ContentLocation": "E",
"Origin": "H",
"FirstPublishLocationId": "<linkedEntityId>",
"Title": "peter_griffin_face1.jpeg",
"PathOnClient": "peter_griffin_face1.jpeg",
"VersionData": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgUFgkUFiEPFxgYFhIfIBghIBsdIiAdHx8eKDQsJCAxHxwYLTImMTU3OjoxIx82OD84Nyg5LzcBCgoKDgwOGxAQGjclHyQrNzA3ODQuKyw3LywuKzgvOCw1LC4wLCw3LCssLSwsLSwrLDQ0LDEsLDcrNy4sLCwsLP/AABEIAMIBAwMBIgACEQEDEQH/xAAbAAEAAg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z1vHrWdfZ5/44rPd/15TcGSm7qd18Fox2iYmuSvEzHp5rPymPlP18oda9dx1+LLrZJ/FM2P+q7SM3tDNuJ6dqRX6/xOef29zH/polvXw3yatum6lra3XM+vp0ibTEXxWrWI9fOatu2sR8omIiPThJ6fq6+Cls2C83tk+O2S15vbJ9Jm0+scT4iPER6REId+l7W9zXrG7Ftf/ax1mlLR48XmZm14/HNYmJ4mJWeDBh1scYtfFWuPmZ4rERHmZmfEfmZktTHCS7k06AI2AAAAAAAAAAAAAAAAAAAAAAAAAACm6jjjpe7XquCOMV7Vx7FY9JieK1y8fdWe2Jn7Oeee2vFyocmHP7Sa+xTLmnH0m/diitYr35q+a2m1pie2k+eIrHPHE90c8RYxy7r4YjxBM8RM8IzZEfR3MG/rV2Na0zSeY8xMTWYnia2rPmLRPrEpAm9gAAAAAAAAAAAAAAAAAAAAAAAAAAADz/SN7V6LqYOkdTy1xWwxGDHa8xFctYjilq2nxNu2I7q+sTE+OOJn0DExFomto8KlnWKq3tH0iNimGm9W0zbsm1PirSZ9IvevNaTMzEREzHMzHC1a3xY8mG2G+OJxTHbNZiOJifWJj6Kv+7nTYmOyM0Y/srs7UU/T3cX7ePxxwfB9mek2x5uq9Wz60x/DzetJmPS2SteLzz8+I93WZ+tJj1qtnPBhxa2GmHXxVrirHbWtYiIiI9IiI9IdEpJqAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/2Q=="
}

Great, it's the chicken and the egg paradox. But seriously, it looks as though what I'm trying to accomplish isn't possible (unless @learningmode has any magical insight into what I'm doing wrong).

I'm hoping to be able to upload a file to Sharepoint/GoogleDocs/etc via Salesforce (from an Upload button on the Files tab/page or the RestAPI or even Apex) so that the file gets inserted/uploaded into the external system and a ContentVersion record gets created from that process, linked to that newly created external document.

Any help would be greatly appreciated.

4
  • Files Connect is designed for surfacing of external content in Salesforce, it's not a bidirectional sync. The closest out of the box solution for your needs is writeable External Objects via Salesforce Connect with 3rd party ODATA drivers....if you have the stomach and $ for all of that. Uploading a file to Sharepoint/Google from Apex by calling REST APIs is possible. Lots of caveats but possible. As another option, there's a ton of commercial middleware in this space and there's always AppExchange.
    – identigral
    Commented Sep 8, 2020 at 21:46
  • That makes sense from what I've seen/experienced, but @learningmode specifically said: "After uploading a Sharepoint file via Salesforce Files Connect, i see a record gets created in Content Version object. I want to know one of the field in Content Version (ExternalDocumentInfo2) , how it is populated". Which means that he didn't insert the ContentVersion record himself because ExternalDocumentInfo2 is required (the problem I'm having). Somehow he did exactly what I'm asking how to do.
    – Bob
    Commented Sep 10, 2020 at 12:31
  • They're talking about the UX shown in this video. The file from an external data source (i.e. Sharepoint) is uploaded via Files Connect. When the file is uploaded, Files Connect could store a reference to the file or a copy of the file. That is still a one-way flow: from external data source to Salesforce.
    – identigral
    Commented Sep 10, 2020 at 17:32
  • @Bob: Did you ever figure this out? I'm stuck with the same issue.
    – Christoph
    Commented Apr 26, 2023 at 10:39

1 Answer 1

0

This question is taken from the Salesforce Integration Architecture Designer Exam. The answer is allegedly B:

NO.55 Universal Containers (UC) is a large printing company that sells advertisement banners. The company works with third-party agents on banner initial design concepts. The design files are stored in an on-premise file store that can be accessed by UC internal users and the third party agencies. UC would like to collaborate with the 3rd party agencies on the design files and allow them to be able to view the design files in the community. The conceptual design files size is 2.5 GB. Which solution should an integration architect recommend?

(A). Create a lightning component with a Request and Reply integration pattern to allow the
community users to download the design files.
(B). Define an External Data Source and use Salesforce Connect to upload the files to an external object. Link the external object using Indirect lookup.
(C). Create a custom object to store the file location URL, when a community user clicks on the file URL, redirect the user to the on-prem system file location.
(D). Use Salesforce Files to link the files to Salesforce records and display the record and the files in the community. 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .