Skip to main content

Files Connect

Files Connect is a Salesforce service that connects Salesforce orgs to external file repositories. This allows users to create and reference external files from Salesforce, such as in Chatter posts and the standard Files tab, and uses less storage than hosting files directly inside Salesforce. When Files Connect is enabled with Medical Information Cloud, users can also initiate document creation and collaboration user flows from inside Salesforce to the external file repositories. This page provides guidance on how to set up and configure Files Connect with Medical Information Cloud and how to use Files Connect documents within Medical Information Cloud. For more information about Files Connect, visit Salesforce's documentation on Salesforce Files Connect.

Warning

While Salesforce's Files Connect service can be used with many different external file repositories, like Google Drive, Box, Sharepoint, One Drive, and more, the Medical Information Cloud product currently only supports a Files Connect integration with Google Drive.

Additionally, external files created with the Files Connect integration are not supported for fulfillments.

Setup and configuration

To set up and configure the Files Connect service inside a Salesforce org that has Medical Information Cloud installed:

1. Create an OAuth consent screen in the Google Cloud console

2. Create an authentication provider in Salesforce

3. Enable Files Connect in Salesforce

4. Grant permission to use Files Connect in Salesforce

5. Define an external data source for Google Drive in Salesforce

6. Grant permission to use Google Drive as an external data source in Salesforce

2. Create an authentication provider in Salesforce

To create an authentication provider for Google Drive in your Salesforce org, complete the following steps. For more information, visit the same Salesforce documentation on how to Create an Authentication Provider for Google Drive.

  1. Log into your Salesforce org.

  2. In Setup, search for and select Auth. Providers.

  3. Click New.

  4. In the Provider Type dropdown, select Open ID Connect. Additional fields will appear.

  5. Enter the following details:

    Name

    Enter a name for the provider that should appear in the Salesforce org. For example, Google Drive.

    URL suffix

    Enter the suffix that should appear at the end of the authentication URL path. For example, in the URL path https://login.salesforce.com/services/authcallback/00Dx00000000001/MyGoogleProvider, the suffix is MyGoogleProvider.

    Consumer Key

    Enter the client ID from step 1r above.

    Consumer Secret

    Enter the client secret from step 1r above.

    Authorize Endpoint URL

    Enter the following:

    https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force

    Token Endpoint URL

    Enter the following:

    https://accounts.google.com/o/oauth2/token

    Default Scopes

    Enter the following:

    openid email profile https://www.googleapis.com/auth/drive
  6. Click Save. The Auth. Providers page will open again and show the newly created authentication provider.

  7. Click the name of the authentication provider to open its details page.

  8. Under the Salesforce Configuration section, copy the Callback URL value.

  9. Navigate back to the OAuth 2.0 client credentials details page in the Google Cloud console from step 1r.

  10. Under the Authorized redirect URIs section, click + Add URI, paste the Callback URL, and click Save.

3. Enable Files Connect in Salesforce

To enable the Files Connect service in your Salesforce org, complete the following steps. For more information, visit Salesforce's documentation on how to Enable Salesforce Files Connect for Your Organization.

  1. Navigate back to your Salesforce org.

  2. In Setup, search for and select Files Connect.

  3. Check the Enable Files Connect checkbox.

  4. Set File Sharing to Reference.

  5. Click Save.

4. Grant permission to use Files Connect in Salesforce

To grant admins and/or users permission to configure and use the Files Connect service in the Salesforce org, respectively, create a new permission set or modify an existing permission set to include the Files Connect Cloud system permission. For more information, visit Salesforce's documentation on how to Let Users and Administrators Access Files Connect Data Sources.

Warning

You must be granted the permission set with the Files Connect Cloud system permission to complete the next setup and configuration steps.

5. Define an external data source for Google Drive in Salesforce

To define Google Drive as an external data source for your Salesforce org:

  1. In Setup, search for and select External Data Sources.

  2. Click New External Data Source.

  3. Enter a name for the external data source. This will appear as the label on the button in the Files Connect component. For example, if you set the name to Google Drive, the button to authenticate to the external service will be "Connect to Google Drive" while the button to select a file from the external service will be "Select from Google Drive".

  4. In the Type dropdown, select Files Connect: Google Drive.

    Note

    If the Files Connect: Google Drive option is missing from the Type dropdown, double check that you have completed step 3 and step 4 above.

  5. Set the Identity Type to Per User.

  6. Set the Authentication Protocol to OAuth 2.0. Additional fields will appear.

  7. Set the Authentication Provider to the authentication provider created in step 2.

  8. Leave the Scope field empty.

  9. Check the Start Authentication Flow on Save checkbox.

  10. Click Save.

  11. Complete the Google authentication flow to enable the external data source.

    Note

    If the authentication flow fails, double check that you have completed step 2.

    The Administration Authentication Status will appear as Authenticated.

6. Grant permission to use Google Drive as an external data source in Salesforce

To grant admins and/or users permission to use Google Drive as an external data source in the Salesforce org:

  1. Open the permission set from step 4.

  2. Click External Data Source Access.

  3. Click Edit.

  4. Select the external data source created in step 5 and click Save.

User authentication

After the Files Connect service is set up and configured with the Medical Information Cloud product, every user must authenticate to Google Drive to create or reference files in the external data source. Users can initiate the authentication flow by clicking Connect to Google Drive anywhere in Medical Information Cloud where the Files Connect component is available, such as the Files Connect tab in the New Document wizard.

Once the authentication flow is complete, a Finish Authorization modal will appear in the Salesforce org and the Connect to Google Drive button will change to a Select from Google Drive button.

Note

The label on the Connect to Google Drive and Select from Google Drive buttons are driven by setup and configuration step 5c above as well as the CM_Authorize_File_Repository and CM_Select_From_File_Repository custom labels.

Possible error messages

If a user encounters the following error message(s) when trying to authenticate or use the Files Connect integration, you should check that the integration was configured properly, that the user has the required permission set, and that the values on the Default MCM Global Setting metadata record have been set appropriately.

Error message

Possible reason(s)

There are no external data sources configured. Please contact an admin to configure Files Connect and add external sources to use this feature.

  • the Files Connect service was not properly configured; or

  • the user was not granted the appropriate permission set to use the Files Connect Service

To add a file contact your administrator to allow additional file options

  • the Hide External File Button (mvn__CM_Hide_External_File_Button__c) field, the Hide Files Connect File Button (mvn__CM_Hide_Files_Connect_File_Button__c) field, and the Hide M365 File Button (mvn__CM_Hide_M365_File_Button__c) field on the Default (CM_Default) metadata record of the MCM Global Setting (mvn__CM_Global_Setting__mdt) custom metadata type are all checked (i.e., equals true)

User flows

After a user authenticates to Google Drive, the user can then initiate the following user flows with the Files Connect service.

Create a new external document

Users can upload documents in Medical Information Cloud to Google Drive. If the document is not yet linked to a file in Google Drive, users can select a location or folder in Google Drive to upload the new document; if the document is already linked to a file in Google Drive, users can either update it or create a new file. If a document has multiple versions with different Google Drive references, Medical Information Cloud uses the last document version for operations such as creating a snapshot of the document.

Warning

The link between the Document record and the source file in Google Drive should never be broken, and users who perform actions that may break the link will see warning messages. For example, if a document has multiple versions and a user attempts to delete the version of the document that is linked to a Google Drive file, then a Confirm External Source Replacement pop-up will appear. For more information about document versions and snapshots with the Files Connect service, reference the Create a snapshot of an external document section below.

Create a new file

To create an external document that references a new Google Drive file:

  1. Navigate to the Documents tab and click New Document. The New Document wizard will open.

  2. Select Files Connect for where the file should be hosted. A Files Connect box will appear with the available file services that have been configured (e.g., Google Drive).

  3. Click Select from Google Drive. The Select from Google Drive wizard will open.

  4. Select My Drive or any available Google Drive folder.

    Warning

    New files can only be created in the My Drive folder and cannot be created in any of the other Google Drive folders.

  5. Click New. A dropdown will open a list of file types that can be created.

  6. Select the type of file to be created. Only the following Microsoft 365 and Google Drive file types are available. A wizard will open.

    Table 157. Files Connect types

    File type

    Microsoft 365

    Google Drive

    Document

    Microsoft Word

    Google Docs

    Spreadsheet

    Microsoft Excel

    Google Sheets

    Presentation

    Microsoft PowerPoint

    Google Slides

    File Upload

    N/A - all Microsoft 365, text, and image files are supported as long as the file extension exists as a Content Type (mvn__CT_Content_Type__mdt) metadata record



  7. Select whether the file should be created with Microsoft 365 or Google Drive, enter a name (and description) for the file, and click Create. The New Document wizard will appear again, and the Title field will be automatically populated with the file name.

    Note

    If the file is created with Microsoft 365, the new file will use the template in the corresponding static resource. For more information, reference the Configure Microsoft 365 file templates section below. However, if the file is created with Google Drive, the new file will be blank.

    Warning

    Users can only create external files in Google Drive that are up to 6MB in size.

  8. Complete the remaining fields and progress through the rest of the New Document wizard. The new Document record will be created, and the document's details page will open.

    Note

    If the file extension that appears in the final screen of the New Document wizard is ".undefined", then snapshots cannot be created for the external document. For more information, reference the Create a snapshot of an external document section below.

Use an existing file

To create an external document that references an existing Google Drive file:

  1. Navigate to the Documents tab and click New Document. The New Document wizard will open.

  2. Select Files Connect to indicate where the file should be hosted. A Files Connect box will appear with the available file services that have been configured (e.g., Google Drive).

  3. Click Select from Google Drive. The Select from Google Drive wizard will open.

  4. Select the Google Drive folder where the file exists or can be found.

  5. Select the file that should be created as a document in Medical Information Cloud.

  6. Click Select. The New Document wizard will appear again, and the Title and Description fields will be automatically populated with the file name and description.

  7. Complete the remaining fields and progress through the rest of the New Document wizard. The new Document record will be created, and the document's details page will open with a preview of the file's existing content.

Configure Microsoft 365 file templates

When a user creates a new Microsoft 365 file in Google Drive through the Files Connect service in Medical Information Cloud, the file is generated with a Microsoft 365 template that is stored as a static resource and defined on the MCM Global Setting (mvn__CM_Global_Setting__mdt) custom metadata type. As a result, the static resource for every Microsoft 365 file type and the configuration on the MCM Global Setting custom metadata type are required for documents to be created as new Microsoft 365 files in Google Drive. Medical Information Cloud ships with several static resources that act as empty Microsoft 365 file templates, but you can add and configure your own templates as well.

To create a new template for a Microsoft 365 file type:

  1. Upload the Microsoft 365 file template as a static resource. The static resource must be either a .docx, .pptx, or .xlsx, file.

  2. Navigate to the MCM Global Setting (mvn__CM_Global_Setting__mdt) custom metadata type.

  3. Edit the Default (CM_Default) metadata record and update the MCM Global Setting field that corresponds to the type of file that was uploaded as a static resource:

    Static resource file type

    MCM Global Setting field

    .docx

    Files Connect Word Template (mvn__CM_Files_Connect_Word_Template__c)

    .pptx

    Files Connect PowerPoint Template (mvn__CM_Files_Connect_PowerPoint_Template__c)

    .xlsx

    Files Connect Excel Template (mvn__CM_Files_Connect_Excel_Template__c)

View an external document

To view an external document, users can open the file directly from the MCM - Document Version File Details (cmDocumentVersionFileDetails) component. When users click Open in the File Details component, a new browser tab is launched that opens the file in Google Drive. Users can also preview the file directly on the Document record's details page, but the file preview is an image of the first page of the file and may not be available for every external document.

Share an external document

To share an external document, users must first modify the sharing settings of the source file. For more information, reference Google's documentation on how to Share files from Google Drive. Users can then share the external document in Medical Information Cloud by either adding others to the Document record or clicking Copy Link in the File Details component and sharing the file link. If a user is added to a Document record or given the file link of a Google document that they do not have access to in Google Drive, then one of two things will occur. If the user is part of the same organization, then they can request access to the Google document. However, if the user is outside of the organization, they will see an "Unauthorized" page.

Edit an external document

Unlike how users can check out regular Document records and files that are hosted inside Medical Information Cloud, users cannot check out external documents and the Check Out Document option on the Document record's details page is disabled (i.e., greyed out). However, users can still make edits to and collaborate on the external documents by opening the file in Google Drive the same way users would to view the file. Any changes made to the file in Google Drive will be reflected in the file preview on the Document record's details page when available.

Start a workflow with an external document

Users can start workflows and complete tasks with external documents the same way as with other documents in Medical Information Cloud. However, external documents cannot be sent as attachments in emails and will be removed from the Attachments table in the Start Workflow modal.

Create a snapshot of an external document

If users want to track changes that are made to external documents at different points in time, users can create manual and automatic snapshots. All snapshots will increment minor versions of the external documents.

Warning

Snapshots can only be created for external files in Google Drive that are 6MB in size or smaller and that are not of Google Drive file types.

Create a manual snapshot

To create a manual snapshot of an external document:

  1. Navigate to the document's details page.

  2. Click Create Snapshot. The New Snapshot Version modal will open.

    Note

    If the Create Snapshot button is disabled, make sure you have edit access to the Document record and that the external document is the latest version of the Document record.

  3. (Optional) Check the Save snapshot to current document version checkbox. This is checked (i.e., equals true) by default.

    When checked, the latest contents of the external file will be retrieved and stored inside the current Document Version record while the link to the external file will be referenced in a new Document Version record. The new Document Version record will therefore maintain the connection between the Document record and the external file, store the latest version of the external file, and increment a minor version of the document. (For example, Version 0.1 will now reference the downloaded copy of the external file while Version 0.2 will reference the actual external file.) When unchecked, the link to the external file will remain on the current Document Version record while the latest contents of the external file will be retrieved and stored inside a new Document Version record. The new Document Version record will therefore still increment a minor version of the document but will lose the reference to the external file such that snapshots can no longer be created for the external document. (For example, Version 0.1 will continue to reference the actual external file while Version 0.2 will reference the downloaded copy of the external file.)

  4. Enter a reason for creating a snapshot.

  5. Click Save.

Create automated snapshots

To configure automated snapshots to be taken when an external document enters a specific state:

  1. Navigate to the Document State Entry Action (mvn__CM_Document_State_Entry_Action__mdt) custom metadata type.

  2. Edit an existing metadata record or create a new metadata record.

  3. Set the Document State field to the state that the external document must enter to trigger the automated snapshot.

  4. Set the Type field to New Snapshot Version.

  5. Click Save.

When an automated snapshot is created, the latest contents of the external file will be saved in the current Document Version record while the link to the external file will be referenced in a new Document Version record. The new Document Version record will therefore maintain the connection between the Document record and the external file, store the latest version of the external file, and increment a minor version of the document.

Warning

If you configure two Document State Entry Action metadata records for the same document state but one is for a new snapshot version while the other is for a new major version, an automated snapshot will create two versions of the external document. To avoid this, do not configure two document state entry actions for the same document state.

Configure snapshot notifications and audit logs

You can configure notifications to be sent and audit logs to be created whenever a manual or automated snapshot is created. To configure snapshot notifications and audit logs:

  1. Navigate to the Document System Event Notification (mvn__CM_Document_System_Event_Notification__mdt) custom metadata type.

  2. Click New.

  3. On the System Event Configuration field, search for and select Document New Version Snapshot (CM_Document_New_Version_Snapshot). The Create Document Audit Log checkbox on the related Document New Version Snapshot (CM_Document_New_Version_Snapshot) System Event (mvn__SE_System_Event__mdt) metadata record is set to true by default.

  4. Click Save.