Salesforce Connector Reference
Use Salesforce as a data source (take new Salesforce records and copy them to a Google Sheet, for example) or a data target (take a new employee in Workday and create a contact in Salesforce). Some details of how to work with data in a flow are specific to the data source or data target. The details also depend on the trigger or actions you choose.
Connections
To connect to a system, whether it is a source of data or the target where you are sending data, you must create a connection with that system’s required credentials. You typically connect to different systems within a flow and can reuse each connection every time you need to connect.
This system requires the following credential information for its connections:
- Connection Name
-
Enter a connection name that will help you remember the details of this connection. You can reuse connections multiple times in a single flow, and in more than one flow, and the credentials are hidden after you create the connection. Therefore, it’s helpful to provide a name that easily identifies this connection from others.
Only you can see the connection. Other users in your Composer app must create their own connections.
- Username and password
-
The username and password that you used to log in to Salesforce. You’ll need to create a connection even if the data source is the same Salesforce org where you operate Composer. However, Composer won’t ask for your password again. Instead, it displays an authentication approval dialog.
- URL
-
The URL that you used to log in to Salesforce, for example,
myOrg.salesforce.com
.
Salesforce Connected App Limits
Salesforce allows each user to grant access to no more than five connected apps at a time. Because of this limit, if you create more than five Composer connections to the same Salesforce org, Salesforce revokes tokens from the oldest to the most recently created, without notice, until the number of authorized tokens returns to five.
If possible, create only one connection per user per Salesforce org to avoid this issue.
For more about Salesforce connected apps and authorization, see the Salesforce documentation.
Relaxed IP Restrictions
If your org has IP restrictions set, errors that reference IP or OAuth failures may occur. Relax the IP restrictions to resolve this error.
To relax IP restrictions on a connection to Salesforce:
-
Log into the Salesforce org. You must be a Salesforce admin in that org.
-
Navigate to Setup > Connected Apps OAuth Usage.
-
Find MuleSoft Platform in the list with the description MuleSoft OCS app for KPROD, and click Install.
-
Click Install on the authorization dialog.
This makes the connected app (the connection you created) available so that you can relax the IP restrictions. It doesn’t reinstall the Composer app.
-
Click Edit Policies.
-
Change IP Relaxation to Relax IP Restrictions and then save your change.
IP restrictions are now relaxed for the connection.
Change a Connection
To change a connection:
-
Open the flow.
-
Click the change icon in the trigger or every action that connects to a sandbox:
-
Choose a new connection and save your changes.
Salesforce Sandbox and Production Orgs
You can connect to Salesforce sandbox and production orgs.
To protect your production org:
-
Connect to a sandbox org when you build and test a flow.
-
After testing is complete, connect to a production org, test the flow with the new connection, and then activate the flow.
Remember to change the connection from sandbox to production in every trigger and action that uses the sandbox connection.
Transfer Binary Files
You can transfer binary files as field inputs using data pills from within your Composer flow. For example, when keeping files in sync between Salesforce instances, you can download binary file content from one instance and later upload that same file content to another instance.
The following Salesforce objects support binary transfers:
-
Content
-
Version Document
-
Attachment
The recommended file size limit per transfer is 25MB and files transferred across systems cannot be truncated.
Triggers
Each flow starts with either a scheduler or a trigger. Schedulers are set to a default frequency of 15 minutes. Triggers, such as "each time a new record is created", are defined by you and provide multiple options related to the data in your system.
Triggers use a polling process to actively check for new updates from an external system. The polling frequency is 15 seconds.
This system provides the following trigger options:
- New record
-
Checks for a new record every 15 seconds.
- New or updated record
-
Checks for new or updated records of the specified object type every 15 seconds.
- Deleted record
-
Checks for soft-deleted records. Soft-deleted records are stored in Salesforce for approximately 15 days.
Records are typically stored for approximately 15 days before being hard-deleted and irretrievable. * You can’t modify the soft-delete timestamp.
Trigger Conditions
You can add trigger conditions to specify which conditions should trigger a workflow, for example, you can restrict a workflow to trigger only when a specific field meets the conditions you specify.
To add a trigger condition:
-
Select a trigger.
-
In the Trigger Conditions section, click on the Criteria dropdown menu and select either All Conditions Must Be Met (AND) or Any Condition Must Be Met (OR).
-
Specify your conditions for specific fields.
To add more trigger conditions, click Add Condition.
Polling Frequency
For triggers in this connector, the Polling Frequency field is required. This field enables you to select how often Composer makes a request to the underling system API to look for changes to records in active flows. You can select a different polling frequency for each flow in your organization. With a shorter frequency, the flow executes more often; however, a shorter frequency consumes more API calls. For example, if you have an order management flow, you might require nearly real-time updates, which can be achieved with a 15-second polling interval (which equates to 5760 API calls per day). In contrast, if your flow updates a pricing catalog, you could poll the flow every hour (which equates to 24 API calls per day).
Actions
After you connect to a system and define the trigger or configure a scheduler, you define the actions that the flow performs. For example, you can copy a record between different systems, such as Workday and Salesforce. The actions you can perform depend on which system you are connected to.
This system provides the following actions:
- Create new record
-
Create a standard or custom record.
- Update record
-
Update any standard or custom record as specified by an external ID.
- Get records
-
Return all the records that match specified criteria:
-
You can choose which fields the action fetches in the Result fields section.
-
You can add one or more conditions to specify which types of records should be returned in the Criteria section. For example, you could specify that the last name begin with "B."
-
You can control the sort order of the returned records in the Sort records section. Records can be sorted in ascending or descending order of a field that you specify.
-
You can select All records in the How Many Records to Retrieve section to retrieve a list of records that match your criteria. The All records option is selected by default. If you want to access a single record from the list, you must add a For Each loop to your flow.
-
If you have filtered your search with a unique identifier, you can select Only the first record in the How Many Records to Retrieve section to return a single record. Returning a single record will change the output of the search from a list to a single record. The Get records action searches for all records and returns only the first record in the list.
If you previously selected All records and then changed your selection to Only the first record, data pills in your existing flow could be invalidated.
When Get Records is a step in your flow, if Field-Level Encryption is enabled and you’re trying to filter on an encrypted field, only the following string operators are supported:
equals
,not equals
, or empty. Field-Level Encryption doesn’t supportcontains
,starts with
, orends with
. For more information on Field-Level Encryption, see the Salesforce documentation. -
- Create or update record
-
Update any standard or custom record as specified by record ID. If the record ID isn’t found, create the record.
- Delete record
-
Delete a record specified by its object type and record ID.
- Upload file
-
Adds a file to a folder in Salesforce.
- Download file
-
Returns the binary contents of the specified file.
Set Error from Action Preferences
If an error occurs within your flow, the error details appear on the Run History page. The Run History page displays the date and time on which the error occurred, an explanation of the error, and the location within the flow where the error occurred. Using this information, you can troubleshoot issues within your flow. However, you can proactively set preferences in advance for handling errors that may occur.
To set an error from action preference:
-
Select an action.
-
In the If an error occurs section, select one of the following:
-
Stop Flow
-
Continue to next step
-
Create an error branch
-
Continue to another branch
-
The error from action preference is set. If an error occurs, the selected preference is enacted in the flow.