Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Connecting Salesforce With MuleSoft

DZone's Guide to

Connecting Salesforce With MuleSoft

Learn how you can fetch and view all chosen accounts objects from Salesforce in MuleSoft with this quick integration tutorial.

· Integration Zone
Free Resource

Modernize your application architectures with microservices and APIs with best practices from this free virtual summit series. Brought to you in partnership with CA Technologies.

As most of you know, Salesforce is a leader in CRM (Customer Relationship Management). Let's see how to connect to Salesforce from MuleSoft.

Use Case

To fetch all accounts objects from Salesforce in MuleSoft.

Steps

  1.  Create a new project in Mulesoft (File->New->Mule Project) and give the project a name. Click Finish.  
    Image title

  2. Create an account on developers.salesforce.com. After sign-in, in the home page top right corner under your name, go to My Settings. Image title

  3. Go to Personal Tab and select "Reset My Security Token." You will get the security token in the registered mail id.

  4. In Anypoint Studio, drag the HTTP component and configure the connector configuration. Select the host and enter the port number. Click OK.Image title

  5. Drag the Salesforce connector from the Mule Palette. Add a connector configuration and select Salesforce: Basic Authentication. Image title

  6. Provide your username, password, and security token. Click on Validate Configuration and check whether the test connection is successful.Image title

  7. Select the "Query" operation andset the Language as "DataSense Query Language." Click on Query Builder. Select Accounts Object and the necessary columns (in my case: AccountNumber, BillingCity, BillingCountry, BillingStreet, and Description) and click OK. The query is automatically generated, as below:Image title

  8. The outcome of the query operation in Salesforce is a consumerIterator object. In order to view the output in a readable form (like JSON), use the object to JSON transformer.

  9. Save the project and right click the project folder in the project explorer->Run As->Mule Application.Image title

  10. In the console, the status of the application can be seen as "DEPLOYED." Go to the browser (or Postman) and hit the endpoint (http://localhost:8081). The selected fields from the Account object are displayed.Image title

The Integration Zone is proudly sponsored by CA Technologies. Learn from expert microservices and API presentations at the Modernizing Application Architectures Virtual Summit Series.

Topics:
salesforce ,mulesoft ,integration ,tutorial

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}