Skip to main content
Contact Us 1-800-596-4880

Connecting your first SaaS application to Salesforce

10 min read

In this final guide, you will be leveraging work created from guides one, two and three of the quick start series to learn how to use Flow Designer to connect data from our API to Salesforce. Flow Designer is an easy to use tool to develop common integrations in a web-based interface. In this tutorial, we are going to use the HTTP Connector to GET in data from our API that we created in the previous tutorials, and automatically add each object as a new Salesforce Lead.

Prerequisites

  • Anypoint Platform - We’ll need an Anypoint Platform account to design our first API. You can sign up for a free trial account here.
  • REST Client - Download and install any REST Client of your choice. There are plenty of options out there for you to use, you can download MuleSoft’s Advanced REST Client, or you can use the popular REST Client Postman. We’ll be using Postman throughout these tutorials.
  • Salesforce account - You can create a Salesforce free developer account here.

Create a Mule application using Flow Designer

Sign in to Anypoint Platform. Go into Design Center, click the Create button at the top right, and then click Create new application.

image

The first step to building our integration is to add an HTTP Connector as the trigger. When you open your project, select the option to go straight to the canvas. Click on the Trigger component, and select HTTP Listener and under path type /submit.

image

Next, click the plus button, then search for the HTTP Request component. In the URL field, insert your unique URL for your API that you’ve deployed in the previous tutorials. You can find this URL in Runtime Manager. Once you have added the URL, click the X to add the next component to your flow.

image

Next, click the plus button again after your HTTP Request connector, and search for the Foreach connector. Add the connector to your flow, then click the X button again to add the next component to your flow.

image

Lastly, search for the Salesforce Connector and select the operation Create. When you create the configuration:

  1. Click the Add connection button
  2. Name your Connection Name whatever you wish
  3. Select Basic Username Password

Enter your Salesforce username and password and login, along with your security token. If you don’t have your security token in your inbox, login to Salesforce and go to Setup > Personal Setup > My Personal Information > Reset My Security Token.

After all your credentials are entered, make sure you select Lead under Type, and under Record type: payload. Then click the Save button and test your application.

If you get the error: Cannot coerce Object, please type in [payload] instead of payload under record type.

image

Test your Salesforce integration

To test out your API and integration, grab the URL that is generated in the temporary environment and paste that into either the Mocking Service or Postman. Don’t forget to add /submit to the end of the URL, and then click the Send button to make the POST request to the endpoint.

image

This execution should take around 30 seconds, and once it’s complete, you should see the complete JSON payload of 100 customer data entries returned in the response. When you log into Salesforce and navigate to New Leads, you should now see each entry added to Salesforce as a New Lead.

image

Amazing right? That’s it! You’ve built your very first integration using Flow Designer which grabs data from your API and inserts it into Salesforce as a new lead.

Next, don’t forget to deploy your application! Go up to the top right, click the blue arrow, and select Deploy Application. For the environment, choose Sandbox and then lastly Deploy.

Next steps

Nice work! If you want to learn more about MuleSoft’s Anypoint Platform, check out our other developer tutorials or our developer certification training.

Previous

Try Anypoint Platform for free

Start your 30-day free trial of the #1 platform for integration, APIs, and automation. No credit card required. No software to install.

Try for free

anypoint product trial zigzag