In this blog we will take a closer look at how to use Salesforce Composite Connector in Anypoint Studio. Here we will go through it step-by-step.
Add Salesforce Composite Connector from exchange
Connector will not be available in the Mule palette initially; we need to import it from the Exchange. As a MuleSoft best practice, always use the latest and greatest connector versions from the exchange.
Configure Connector in Studio
To create a global element for the connector, configure these fields:
- OAuth with Username and Password Authentication:
- Consumer Key - The consumer key for the Salesforce connected app
- Consumer Secret - The consumer secret for the connector to access Salesforce
- Username - The Salesforce username
- Password - The corresponding password
- Security Token- The corresponding security token
The consumer key and secret can be obtained once we create a connected app in Salesforce. A connected app is a framework that enables an external application to integrate with Salesforce using APIs.
Steps to create connected app in Salesforce
- Login to Salesforce
- Navigate to Setup → Apps → App Manager → New Connected App
- Fill Required fields
- Connected App name
- Contact Email
- Enable OAuth Settings
- Provide call back url
- Select full access OAuth Scopes
- Click Save button
Once the connected app is created consumer key and consumer secret can be found under API (Enable OAuth Settings) section
Using a Anypoint Salesforce Composite Connector a developer can
- Create one or more sObject trees with root records of the specified type.
- Can create Up to a total of 200 records across all trees
- Up to five records of different types
- SObject trees up to five levels deep
- In the request we should provide type and reference ID of each record