trailhead

Set up Salesforce Connect

Learning Objectives

After completing this unit, you’ll be able to:
  • Create an external data source in your Salesforce org to specify how to connect to an external system.
  • Validate the connection to the external system.
  • Sync to create external objects that map to the external system’s schema.
  • View the external objects.

Overview of Setup

Setting up external data integration with Salesforce Connect involves these high-level steps.

  1. Create the external data source. If your external system hosts multiple services, create an external data source for each service that’s required to access the data.
  2. Create the external objects and their fields. Create an external object in your Salesforce org for each external data table that you want to access. On each external object, create a custom field for each external table column that you want to access from your Salesforce org.
    Note

    Note

    If the external system allows it, we recommend that you sync the external data source to automatically create related external objects. You can instead choose to manually define external objects to customize the external object names and manually create the custom fields.

  3. Define relationships for the external objects. Create lookup, external lookup, and indirect lookup relationship fields to provide seamless views of data across system boundaries.
  4. Enable user access to external objects and their fields. Grant object and field permissions through permissions sets or profiles.
  5. Set up user authentication. For each external data source that uses per-user authentication, do both of the following.
    1. Enable users to authenticate to the external data source. Grant users access through permission sets or profiles.
    2. Set up each user’s authentication settings. Tell your users how to set up and manage their own authentication settings for external systems in their personal settings. Alternatively, you can perform this task for each user.

As part of this module, you integrate sample order data with the existing account data in your Salesforce Developer Edition. To go through the steps, you need to install a test package that configures the necessary schema on the account object, creates a Customer ID field, and assigns a value for Customer ID to each account.

Follow these steps to install the package.

  1. Open a browser, and click here to start the installation.
  2. Select Install for Admins Only.
  3. Click Install.Installer for the Salesforce Connect Quickstart package
  4. Select the External Orders app.
  5. Click Set Customer IDs to assign customer ID numbers to the sample account records in your Developer Edition.Assign Customer IDs to sample account records

Your Salesforce Developer Edition is now set up for the main section of the tutorial. It’s time to integrate some data!

Connect an External Data Source

As an exercise, let’s connect an existing OData 2.0 data source that’s publicly accessible.

  1. From Setup, enter External Data Sources in the Quick Find box, then select External Data Sources.
  2. Click New External Data Source.
  3. Enter OrderDB as the label. As you click or tab away from the label field, the name field defaults to OrderDB.
  4. Select Salesforce Connect: OData 2.0 as the type.
  5. Enter https://orderdb.herokuapp.com/orders.svc/ as the URL.
  6. Leave the remaining settings with their default values and click Save.
Note

Note

Because this is a sample, read-only database, no authentication is required. A real external system would likely require some credentials. You can configure Salesforce Connect to use the same set of credentials for all access to the data source or separate credentials for each user.

Now that you’ve configured an external data source, you can select the tables you wish to integrate into your Salesforce org.

Create External Objects

You can create or modify an external object.

  1. From Setup, enter External Data Sources in the Quick Find box, then select External Data Sources and then click the OrderDB external data source.
  2. Click Validate and Sync.
    Note

    Note

    Salesforce Connect retrieves OData 2.0 metadata from the sample database and lists the available tables. Click here for a look at the metadata XML.

  3. Select both Orders and OrderDetails.
    Validate External Data Source dialog
  4. Click Sync.

Syncing creates the external objects corresponding to the tables that you selected. Syncing does not store any data in Salesforce. Syncing only defines mappings to external tables or repositories that contain the data. These mappings enable Salesforce to access and search the external data.

Note

Note

You can choose to manually create the external objects. Doing so enables you to customize the external object names, decide which table columns to create custom fields for, and customize the custom field names. From Setup, enter External Objects in the Quick Find box, then select External Objects.

View External Data

After you’ve connected the external data source and defined the external objects, you can view the external data directly in your Salesforce org.

  1. From Setup, enter External Data Sources in the Quick Find box, then select External Data Sources.
  2. Click the OrderDB external data source.
  3. Scroll down to External Objects and click Orders.View external objects page
Salesforce Connect’s sync process created this external object from the external system’s schema. If you’re familiar with custom objects, you notice that external objects look similar. The sync process also created a set of custom fields just as you create them for a custom object. The key differences between external object and custom object definitions are:
  • External object API names have the suffix __x rather than __c.
  • External objects have a reference to their external data source and a table within that source.
  • External objects have different standard fields. Display URL is the OData 2.0 URL representing a record in the external database, while External ID is the primary key value for each record.
External objects details page

Let’s create a custom tab to easily access the order records.

  1. From Setup, enter Tabs in the Quick Find box, then select Tabs.
  2. Click the New button next to Custom Object Tabs.
  3. Select Orders as the Object.
  4. Click the selector next to Tab Style and choose whichever style you like.
  5. Click Next.
  6. Click Next to accept the default tab visibility settings.
  7. Click the checkbox next to Include Tab to deselect all the apps.
  8. Click the checkbox next to External Orders to select it.
  9. Click Save.
Note

Note

Because there’s also a standard object named Order, you now have two tabs with the label of Orders. You can change the tab name for your external object by changing the label in the object definition.

You can now view the external order data as if it was stored in custom objects in your Salesforce org.

  1. If the app menu (top right) is not already showing External Orders, click the app menu and select it.
  2. Click the Orders tab.
  3. Click the Go! button next to View: All. View list of external ordersSalesforce Connect retrieved order IDs for the first 25 order records from the sample order database. You can configure the fields you want displayed, as in any other list view.
  4. Click one of the order External ID values. View details of external orderSalesforce Connect retrieved all the field values for the order you selected.

It’s important to remember that external data is never duplicated in your Salesforce org. Salesforce Connect always fetches current data from the external system in real time.

Now that you can see external data in your org, you can also link it to existing data by creating lookup relationships. You’ll see how to do that in a later unit.

Set Up User Authentication

The sample database used in this unit did not require authentication. However, a real external system is likely to require login credentials. You have two options for setting up user authentication for an external data source.
  • Named Principal—Your entire Salesforce org shares one login account on the external system.
  • Per User—Your org uses multiple login accounts on the external system. You or your users can set up their personal authentication settings for the external system.

For more information, see Identity Type for External Data Sources in the Salesforce Help.

retargeting