Connecting to Salesforce from IBM App Connect on IBM Cloud and App Connect Enterprise as a Service

In IBM® App Connect on IBM Cloud, you can connect to Salesforce with only a user ID and password or with a client ID and secret.

Remember: You can connect to Salesforce either from the App Connect Designer Catalog page, or when you add an app to a flow. For more information, see Connecting to applications and APIs.

To create a connection from App Connect to a Salesforce account, complete the following steps. These steps assume you are using the App Connect Designer Catalog page.

Open the Connect to Salesforce dialog and then choose your authorization method:

  1. Open the Connect to Salesforce dialog, by using one of the following options:
    • If this is your first Salesforce connection, under Salesforce you'll see Not connected. Click Connect.
    • To add another Salesforce connection, expand the Accounts list under Salesforce and then click Add a new account.
  2. In the Connect to Salesforce dialog, select an Authorization method:
    • Use the application's website to sign in (OAUTH 2.0 AUTH CODE): Use this option to authorise App Connect by logging in to a Salesforce account with its username and password.
      Note: If you later try to use Firefox to update an account in App Connect that was created with Use the application's website to sign in (OAUTH 2.0 AUTH CODE), the Firefox option "Block pop-up windows" prevents the Connect to Salesforce dialog appearing. You can update the account in App Connect by either using a different browser or momentarily turning off the Firefox option "Block pop-up windows".
    • Provide a username, password, and client credentials (OAUTH 2.0 PASSWORD): Use this option to authorise App Connect with the client ID and secret from your own Salesforce connected app.
  3. Click Continue.

Continue with the steps for your chosen authorization method:

  • Use this option to authorise App Connect by logging in to a Salesforce account with its username and password.

    1. If required, specify the Salesforce environment (production or sandbox), or subdomain (with a personalized login page) that you want to connect to. The type of environment or subdomain you can connect to depends on your Salesforce edition. For example, sandboxes are available in some editions like Professional, Enterprise, Performance, and Unlimited, but aren’t available in the Developer Edition.
      • If you're connecting to a standard production environment, you can leave the Custom URL field blank and click Connect. When you connect, you'll be automatically directed to the generic, non-instance-specific production URL: https://login.salesforce.com

        Alternatively, you can specify a production instance by entering its login URL in the Custom URL field in the following format (without the https:// prefix):

        instance.salesforce.com

        where instance represents the name of the production instance you're connecting to; for example, na19, eu11, or ap1 for the North America, EMEA, or Asia Pacific regions.

      • If you're connecting to a standard sandbox that's being used for development or testing, you'll need to first specify its login URL in the Custom URL field by using either of these values (without the https:// prefix):
        • test.salesforce.com (the generic, non-instance-specific URL)
        • instance.salesforce.com

          where instance represents the name of the sandbox instance you're connecting to; for example, cs19.

      • If you're connecting to your company's personalized login page (with a configured subdomain) in a production environment, you'll need to first specify the URL in the Custom URL field using the following format (without the https:// prefix): subdomain.my.salesforce.com

        where subdomain represents the name of a subdomain defined within your Salesforce org to replace the instance name; for example, myCompanyName.

        Tip: If you're using the Developer Edition, the custom URL should end with -dev-ed.my.salesforce.com rather than .my.salesforce.com, which is used in other editions.
      • If you're connecting to your company's personalized login page (with a configured subdomain) in a sandbox environment, you'll need to first specify the URL in the Custom URL field using the following format (without the https:// prefix): subdomain--sandboxname.instance.my.salesforce.com

        where subdomain represents the name of a subdomain defined within your Salesforce org to replace the instance name, sandboxname is your assigned sandbox name, and instance is the name of the sandbox instance; for example, myCompanyName--mySandboxName.csN (where N is a number).

    2. Click Connect (and then click Continue to close the message about your Salesforce account requirements).
    3. In Salesforce, specify the user name and password of the Salesforce environment you want to connect to (and if needed select to use a custom domain), then click to allow the App Connect on IBM Cloud® instance to access Salesforce.
      Tip: If you are already logged in to Salesforce in the same browser window as App Connect on IBM Cloud, App Connect offers that Salesforce account as the default choice to connect to. To connect to a different Salesforce account, you can select the Log In with a Different Username option.
      Figure 1. Example of connecting to Salesforce from App Connect
      Example showing fields in App Connect and Salesforce used to connect Salesforce to App Connect on IBM Cloud(Click image to view full size)

  • Use this option to authorise App Connect with the client ID and secret from your own Salesforce connected app.

    1. Complete the connection fields that you see in the App Connect Designer Catalog page or flow editor. If necessary, work with your Salesforce administrator to obtain these values.
      • Login URL: Specify the login URL of your Salesforce instance, prefixed with https:// and optionally suffixed with a forward slash (/).

        To obtain the Login URL value, complete the following steps:

        1. In your Salesforce instance, click the View profile icon. The URL is displayed below your user name.

          (Click the image to view full size.)

        2. Construct the Login URL value by adding the https:// prefix and an optional forward slash (/) suffix to this URL; for example, https://login.salesforce.com, https://myInstance.salesforce.com, or https://mySubdomain.my.salesforce.com/.
      • Username: Specify the user name (in the form of an email address) that you use to log in to your Salesforce instance.
      • Password: Specify the password that you use to log in to Salesforce, suffixed with your Salesforce security token.
        To obtain the Password value, complete the following steps to retrieve the security token that is tied to your Salesforce password:
        1. If you had previously reset the security token in your Salesforce instance, locate the email (containing the security token details), which was sent to the email address that is set for your user profile.

          Alternatively, reset the security token as follows:

          1. Click the View profile icon in your Salesforce instance and then click Settings.

            (Click the image to view full size.)

          2. In the navigation pane, click Reset My Security Token. A message is displayed, informing you that the existing security token will be invalidated.
          3. Click Reset Security Token to confirm that you want to continue.

            (Click the image to view full size.)

            The new security token is sent to the email address that is set in the Personal Information page.

        2. Log in to your email account and locate the email from Salesforce.

          (Click the image to view full size.)

        3. Construct the Password value by appending the security token to the password that you use to log in to your Salesforce instance; for example, MypasswordMysecuritytoken.
          Note: If you change your password, you’ll require a new security token for that password. You should expect to receive an email from Salesforce with details of the new security token, and will need to update the Salesforce account in App Connect to specify the new password and security token within the Password field.
      • Client ID: The consumer key that is generated when you create a connected app for App Connect in Salesforce.
      • Client secret: The consumer secret that is generated when you create a connected app for App Connect in Salesforce.

        To obtain values for the Client ID and Client secret fields, you'll require a connected app that enables App Connect to integrate with Salesforce by using APIs and protocols. You can create a connected app as documented in the steps that follow. If you already have a connected app that you would like to use, skip to the step below to locate the consumer key and consumer secret that were generated when you created the connected app.

        Note: The following Salesforce user permissions are required to create a connected app: Customize Application AND either Modify All Data OR Manage Connected Apps.
        To create a connected app and generate the Client ID and Client secret values, complete the following steps:
        1. From your Salesforce instance, create a connected app as follows:
          1. Go to Setup () and then click Apps > App Manager in the navigation pane.
          2. Click New Connected App.
          3. In the New Connected App page, specify basic information for the connected app and then enable OAuth settings for integration with the Salesforce API:
            • Connected App Name: Specify a unique name for the connected app.
            • API Name: Accept the default value that is generated when you click within this field.
            • Contact Email: Specify an email address that Salesforce can use to contact you if required. (This can be the email address that is specified under your user profile or an administrator's email address.)
            • Enable OAuth Settings: Select this check box.
            • Callback URL: Select the Enable for Device Flow check box to generate a callback URL, or manually specify any valid secure URL. (This URL will not be used by your connected app).
            • Selected OAuth Scopes: Select Manage user data via APIs (api) in the Available OAuth Scopes list and add it to the Selected OAuth Scopes list.

            (Click the image to view full size.)

          4. Click Save and then click Continue.
          5. Click Manage.

            (Click the image to view full size.)

          6. In the OAuth Policies section, ensure that Permitted Users is set to All users may self-authorize. If this option is not selected, connections might fail even if the correct credentials are supplied.

            (Click the image to view full size.)

        2. Locate the consumer key and consumer secret that were generated for the connected app:
          1. Under Setup (), click Apps > App Manager in the navigation pane.
          2. Click the options menu for the connected app that you created and then click View.

            (Click the image to view full size.)

          3. Click Manage Consumer Details. You will be asked to verify your identity by using the verification code sent to your registered email.

            (Click the image to view full size.)

          4. Log in to your email account and locate the email from Salesforce that contains the verification code.
          5. Enter your verification code, then click Verify.
          6. In the Consumer Details section of the resulting page, locate and then copy the values in these fields:
            • Consumer Key: Set this as the value for the Client ID field.
            • Consumer Secret: Set this as the value for the Client secret field.

            (Click the image to view full size.)

    2. Click Connect (and then click Continue to close the message about your Salesforce account requirements).

Result

This creates an account in App Connect. For more information about ways to connect to Salesforce from App Connect on IBM Cloud, see Managing accounts in App Connect.

Tip:

Before you use the account that is created in App Connect in a flow, rename the account to something meaningful that helps you to identify it. To rename the account on the Catalog page, select the account, open its options menu (⋮), then click Rename Account.

What to do next

See the following resources: