Salesforce Module Basics
  • 12 Aug 2022
  • 4 Minutes to read
  • Dark
    Light

Salesforce Module Basics

  • Dark
    Light

Article Summary

Module Details

Core Module
Restart Required No
Step Location Integrations > SalesForce
Settings Location System > Settings SalesForce
Prerequisites
  • Existing Salesforce Account
  • Access to Salesforce API
  • Installation of Salesforce Module. To learn how to install a module, see Installing Modules. Upgrading to Salesforce API v48+ is preferred, the default Salesforce API version is v32.0.
  • Decisions hosted on HTTPS
  • Setting Salesforce as an OAuth Provider and Salesforce Token. To learn more, see Establishing an OAuth Provider and Creating OAuth Tokens.

The Salesforce Module allows users to integrate with Salesforce to automate their sales processes through pre-built Flow steps. 

Sales teams will be able to create and manage accounts, campaigns, contacts, sales leads, and contracts. 

Salesforce uses two primary API systems for developers to interact with Salesforce data called SOAP and REST. 

The Salesforce Module uses the REST API because the Salesforce SOAP API is unique for each customer. 










Integrating with Salesforce

The Salesforce Module has pre-built steps that use the Salesforce REST API and OAuth for security to communicate with Salesforce.  The following data types can be found, accessed, edited, and saved using the pre-built steps.

AccountCaseLeadProduct
AssetContactOpportunityQuote
CampaignContractOpportunityProductUser
CampaignMemberIdeaPriceBookEntryTask

Using any of the pre-built salesforce steps requires a set up of an OAuth Provider and OAuth token. OAuth is a standard mechanism for providing security to communicate with a web service.

The information to complete the required fields for Salesforce can be located by navigating to SETUP > Apps > Connected Apps > Manage Connected Apps in the Salesforce platform. Click Edit next to the desired connected app. 

From here the Callback URL can be defined as {baseportal}/HandleTokenResponse , substituting {baseportalurl} with the portal URL for the Decisions instance.

The Consumer Key and Secret will also be available from this location.  

OAuth Tokens for Salesforce

In Decisions, an OAuth token will need to be configured, which represents a user that will be used to run the REST API and interact with the data in Salesforce. There are two types of tokens for interacting with Salesforce: Authorization and Access Tokens.

TokenDescription
AuthorizationThis token can be set up one time and requires communication between Decisions and Salesforce with a user signing into the Salesforce page and retrieving a token to store in Decisions. Once it is set up, the authorization token should not expire.
AccessThe access token is created using the authorization token, but will expire periodically and needs to be refreshed. This can be done automatically in Flows using Flow steps



Decisions OAuth Provider Configuration

  1. Navigate to System > Integrations > OAuth > Providers. Right-click on SalesForce.com and select Edit Provider Settings.
  2. Enter the Consumer Key and Consumer Secret Key, Token Request URL, Authorize URL, and Callback URL. Then, click SAVE.
    Below are the values needed for Token Request, Authorize, and Callback URLs that need to be configured.
    URLExample
    Token Request URLhttps://login.salesforce.com/services/oauth2/token
    Authorize URLhttps://login.salesforce.com/services/oauth2/authorize
    Callback URL{baseportal}/HandleTokenResponse

  3. Navigate to System > Integrations > OAuth > Tokens. Click CREATE TOKEN. Provide a name for the Token and select Salesforce.com from the Providers dropdown list. Under OAuth Flow, click the dropdown list and select Password. Enter the User Name and Password and click Request Token. If successful the Status message will display Authorization Received. Click OK to close the dialog window.
    Clicking CREATE TOKEN may display a warning if the BaseURLToPortal is not configured to an externally addressable IP or FQDN in the settings.xml. This will NOT prevent token creation but will have a manual step because Salesforce will not be able to redirect traffic back to Decisions installation. This warning can safely be ignored.
    OptionDescriptionAccess Token StepRefresh Data Steps
    Token NameDesired Name of Token that will be used in Flow to selectN/AN/A
    ProviderOAuth ProviderN/AN/A
    OAuth Flow
    Authentication CodeRequires interaction by the Resource Owner. A browser window takes the user to authenticate with the Authorization Server, after which the browser returns a HandleTokenResponse endpoint with a code. The server then exchanges the code for a token at the token endpoint. The Flow returns a token and refresh data.Refresh Access TokenManually needs to be reset
    PasswordThe username and password entered into the platform are sent to the Authorization Server to get a token. Since the username and password are saved, no user interaction is required, making it possible to obtain new tokens in a Decisions Flow automatically. The Flow returns a token only.Refresh Access TokenReset Password Grant Token
    Client CredentialsSimilar to a Password OAuth Flow except uses the client ID (consumer key) and client secret (consumer secret key) instead of username and password. It also does not require user interaction and returns a token only.Refresh Access TokenReset Client Credentials Token
    OIDC HybridUses parts of the OpenID Connect protocol to obtain a token. It can be configured to return a token only or a token and refresh data.Refresh Access TokenManually needs to be reset
    User NameEmail/username used to log into chosen OAuth providerN/AN/A
    PasswordPassword and Token (from Salesforce)N/AN/A
    If refresh data is provided to the user, use Authentication Code.



Using the Steps

Using the Salesforce steps is like using any other step in Decisions. One of the properties in all Salesforce steps provided is the Token Id.  Changing the input mapping to Constant will display a dropdown list of tokens that have been configured.



Mapping Data with Custom Fields

The Salesforce data types that are provided by Decisions have simple properties that users can map data into or specify. For custom fields, there is a property called CustomFields which is an array of custom fields.

In the screenshot below, the Mapping Editor for a Create Case step is opened. The CustomFields property is set to Build Array which lets the user create a new custom field array to send to Salesforce. In Salesforce, a custom field can be used for the value by inputting the Salesforce API name for the custom field.

Finding Salesforce API Field Name

The Develop Menu in Salesforce lists all data types. Selecting a data type will display the custom fields with the API name of the field. Below, the Decisions Folder Id field label is given the Salesforce API Name of Decisions_Folder_Id_c. This will be the name to use in Decisions when editing or setting the custom field.

Below is the mapping in the Decisions Mapping Editor for the custom field.



Was this article helpful?