Red Hat Training

A Red Hat training course is available for Red Hat Fuse

Chapter 16. Connecting to Salesforce

In an integration, to connect to Salesforce, you must register your Fuse Online environment as a Salesforce client application. This authorizes Fuse Online to access Salesforce. With registration in place, you create a Salesforce connection, which you can then add to any number of integrations. For details, see the following topics:

16.1. Registering Fuse Online as a Salesforce client application

In an integration, to connect to Salesforce, the first thing you must do is register your Fuse Online environment as a client application that can access Salesforce. This lets you create any number of integrations that connect to Salesforce. In other words, you need to register a particular Fuse Online environment with Salesforce only once.

In each Fuse Online environment, there can be only one registration of Fuse Online as a Salesforce client application. However, while each Salesforce connection uses the same registration, it can use different user credentials.

Prerequisite

You are logged in to Fuse Online. The URL for accessing Fuse Online is in the email message that welcomed you to the Red Hat Fuse Online Evaluation program.

Procedure

  1. In Fuse Online:

    1. In the left panel, click Settings.
    2. On the Settings page, near the top, to the right of the callback URL, click Copy Callback URL to copy the callback URL for your Fuse Online environment to the clipboard. You will need this URL toward the end of this procedure.
    3. To the right of the Salesforce entry, click Register to display the Client ID and Client Secret fields.
  2. In another browser tab, log in to your Salesforce account and follow the steps below to create a connected app. These instructions assume that you are using the Salesforce Classic user interface. To switch from the Salesforce Lightning Experience interface, click your profile icon and select Switch to Salesforce Classic. For additional information, see the Salesforce documentation for Create a Connected App.

    1. In Salesforce, in the upper right, click Setup.
    2. In the left panel, select Build > Create > Apps.
    3. Scroll down to Connected Apps and click New.
    4. Enter the required information and then select Enable OAuth Settings.
    5. In the Callback URL field, paste your Fuse Online URL, which you copied at the beginning of this procedure. For example: https://app-proj912876.7b63.fuse-ignite.openshiftapps.com/api/v1/credentials/callback.
    6. For OAuth Scopes, add:

      • Access and manage your data (api)
      • Allow access to your unique identifier (openid)
      • Perform requests on your behalf at any time (refresh_token, offline_accesss)
    7. Select Configure ID token and then Include Standard Claims.
    8. Scroll down and click Save.
    9. Scroll up to see that Salesforce indicates a short wait: SF message to wait a few minutes
    10. Click Continue.
    11. Copy the consumer key that Salesforce provides.
  3. Return to your Fuse Online Settings page and paste the Salesforce-provided consumer key into the Fuse Online Salesforce Client ID field.
  4. Return to Salesforce and copy the consumer secret that Salesforce provides.
  5. Return to your Fuse Online Settings page and paste the Salesforce-provided consumer secret into the Fuse Online Salesforce Client Secret field.
  6. Click Save and then click Ok.

16.2. Creating a Salesforce connection

To create an integration that accesses data in Salesforce, you must first create a Salesforce connection. After you create a Salesforce connection, you can use it in multiple integrations.

Prerequisites

  • You are logged in to Fuse Online. The URL for accessing Fuse Online is in the email message that welcomed you to the Red Hat Fuse Online Evaluation program.
  • Fuse Online is open in a web browser.
  • You must have already registered your Fuse Online environment as an application that can access Salesforce.
  • You added the Salesforce client ID and client secret that you received after registration to the Fuse Online Settings page.

    Be sure to wait 2 - 10 minutes after registering your Fuse Online installation as a Salesforce client before you try to create a Salesforce connection.

Procedure

  1. In Fuse Online, in the left panel, click Connections to display available connections.
  2. In the upper right, click Create Connection to display the available connectors. A connector is a template for creating one or more connections.
  3. Click the Salesforce connector.
  4. Click Connect Salesforce to display a Salesforce authorization page. You might need to log in to Salesforce before you see the authorization page.

    If Connect Salesforce does not appear, then your Fuse Online environment is not registered as a Salesforce client application. See Registering Fuse Online as a Salesforce client application. When you try to create a Salesforce connection and your Fuse Online environment is not registered as a Salesforce client application, then Fuse Online displays multiple fields that prompt for authorization information. While you can create a Salesforce connection by entering values in these fields, it is not recommended.

    Note

    The following error indicates that Salesforce does not have the correct Fuse Online callback URL:

    error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration

    If you get this error message, then in Salesforce, ensure that the Fuse Online callback URL is specified according to the instructions in Registering Fuse Online as a Salesforce client application.

  5. Click Allow to return to Fuse Online.
  6. In the Connection Name field, enter your choice of a name that helps you distinguish this connection from any other connections. For example, enter SF Connect 1.
  7. In the Description field, optionally enter any information that is helpful to know about this connection. For example, enter Sample Salesforce connection that uses my Salesforce login credentials.
  8. In the upper right, click Create to see that the connection you created is now available. If you entered the example name, you would see that SF Connect 1 appears as a connection that you can choose to add to an integration.

16.3. Adding a Salesforce connection to an integration

In an integration, you can connect to Salesforce in the middle of a flow or to start or finish a simple integration. To do this, add a Salesforce connection to the integration.

Prerequisites

  • You created a Salesforce connection.
  • You are creating or updating an integration.
  • Fuse Online is prompting you to choose a start connection, or to choose a finish connection, or to choose a step.

Procedure

  1. Click the Salesforce connection that you want to add to the flow. When the integration uses the connection that you select to connect to Salesforce, Fuse Online uses the credentials defined in that connection.
  2. Click the action that you want the selected connection to perform. Each Salesforce connection that you add to a flow performs only the action you choose.
  3. Specify the Salesforce object that the action operates on, for example, it might be a contact, lead or price book entry. Click in the Object field to select from a list of Salesforce objects or enter the name of the object.
  4. Click Done to add the connection to the flow.

Result

The connection appears in the integration flow in the location where you added it.