Salesforce Authentication action

Salesforce Authentication is the first command action that you need to call to get authenticated with Salesforce.

Note: The examples and graphics provided on this page are for representation purposes only and may not accurately reflect your specific instance. We do not assume responsibility for their maintenance or accuracy.
Authenticate access to Salesforce by getting the authentication parameters from the Salesforce connected app and using them in Automation 360.
Note: Recently, Salesforce implemented the following: OAuth 2.0 Username-Password Flow Blocked by Default in New Orgs. Ensure you allow these flows in your Salesforce environment to use the Salesforce package. See OAuth and OpenID Connect Settings.
You can use different connection methods to connect to Salesforce:
  • OAuth2 - Client Credentials: Use this connection method by providing the Salesforce account credentials. You need a Salesforce username and password to establish a connection.
  • Control room OAuth connection: Use this connection method by creating an OAuth connection and storing it in the Control Room.

Procedure

  1. Log in to the Control Room.
  2. Create a new bot or modify an existing bot. For more details, see Create your first bot.
  3. From the Actions pane, select Salesforce > Authentication and place it under the Start of the bot flow.
  4. In the Authentication Type field, select the authentication method from the drop down.
  5. To view client ID and client secret details for OAuth2 - Client Credentials authentication, complete the following steps:
    1. Log in to the Salesforce Enterprise Edition (Lightning Experience - Salesforce Login), click Salesforce gear icon, and select Setup on your connected app. For more information about creating a new connected app, see Salesforce Connected Apps.
    2. In the Lightning Experience App Manager, click App Manager.
      Salesforce App Manger
    3. Click the down arrow next to app name and select View.
      The Manage Connected Apps screen appears. For more information about managing connected apps, see Salesforce Manage Connected Apps.
    4. Click Manage Consumer Details.
    5. Click Copy that corresponds to Consumer Key.
    6. Click Copy that corresponds to Consumer Secret.Copy Key and Secret from Saleforce
  6. To connect using OAuth2 - Client Credentials, complete the following steps:
    1. In the Client ID field, paste the Consumer Key copied from the Salesforce Connected App. In this illustration Insecure string is used, while you can use Credential or Variable options for better security.
    2. In the Client Secret field, paste the Consumer Key copied from the Salesforce Connected App. Integrating Saleforce
    3. Enter the Salesforce username.
    4. Enter the Salesforce password.
      Note: You can use one of the following options to specify the Client ID/Client secret/ Salesforce username/ Salesforce password:
      • Credential: Enables you to use a value in the Credential Vault that contains information about the Client ID/Client secret/salesforce username/salesforce password.
      • Variable: Enables you to use a credential variable that contains information about the Client ID/Client secret/salesforce username/salesforce password.
      • Insecure string: Enables you to enter the Client ID/Client secret/salesforce username/salesforce password manually.
    5. Select Production to log into a live environment or Sandbox to log into a testing environment.
  7. To configure a Control room OAuth connection in Salesforce, complete the following steps:
    1. Complete step 1 to step 5 in Create OAuth connection.
    2. Log in to Salesforce as an Admin and navigate to App Manager to create a new connected app.
    3. Enter the following details:
      • Connected App name
      • API name
      • Contact email
      • Select the Enable OAuth Settings check box.
      • Add the Callback URL from Create OAuth connection as an authorized redirect URI.
      • Select the OAuth scopes as Manage user data via APIs (API) and Perform requests at any time (refresh_token, offline_access).
        Note: For the Control Room OAuth connection to work, you must ensure to add the appropriate scopes when configuring Salesforce and the appropriate Control Room OAuth connection in the Control Room for Salesforce. For more information, see Create OAuth connection.
      • Select the Authorization Code and Credentials Flow check box.
    4. Click Save.
    5. Click Manage Consumer Details. Copy the client key and secret.
    6. Go to Create OAuth connection and complete the remaining steps to create an Oauth connection with the above details.
  8. To connect using Control room OAuth connection, pick a Salesforce OAuth connection you have created and stored in the Control Room. For more details, see Configure OAuth connections in Control Room.
  9. Enter the API version. You can find the API version in your Salesforce Enterprise Edition setup. For more details, see Find Salesforce API version.
  10. Enter Default as the Session name.
  11. Create either a Multiple or Dictionary variable to store the response. You can do one of the following:
    • The authentication command returns a dictionary with 2 key-value pairs. Authorization (credential type) and InstanceUrl (String type). The Authorization is hidden, but you will be able to read the InstanceUrl. For example, you can use a message box to print of the value of , $str_Authresponse{InstanceUrl}$, this returns the Salesforce URL.
    • You can select Multiple variable as shown below and map to a credential variable and a string variable as keys.
      Salesforce authentication storing multiple variable
      Authorization returns a token, which is hidden as it is a credential type, this token can be passed directly in the Rest Web Services command.
  12. Click Run to save and run your bot. Once authenticated, you will be able to use the token to call other Salesforce API services.