Import Leads into Salesforce using Batch Processing

(0 reviews)


Illustrates how to use batch processing to import leads into a Salesforce instance.

Batch processing lets you split a payload into individual elements to process each individually. This functionality is particularly useful when working with streaming input or when engineering "near real-time" data integration between SaaS applications.

Batch Processing documentation


This example uses batch processing to address a use case in which the contents of a comma-separated value file (CSV) of leads – comprised of names, birthdays, and email addresses – must be uploaded to Salesforce. To avoid duplicating any leads, the batch job checks to see if a lead exists before uploading data to Salesforce.

Set Up and Run the Example

Complete the following procedure to create, then run this example in your own instance of Anypoint Studio. You can create template applications straight out of the box in Anypoint Studio and tweak the configurations of this use case-based template to create your own customized applications in Mule.

  1. Open the Example project in Anypoint Studio from Anypoint Exchange. Do not run the application.
  2. Log in to your Salesforce account. From your account menu (your account is labeled with your name), select Setup.
  3. In the left navigation bar, under the Personal Setup heading, click to expand the My Personal Information folder.
  4. Click Reset My Security Token. Salesforce resets the token and emails you the new one.
  5. Access the email that Salesforce sent and copy the new token onto your local clipboard.
  6. In your application in Studio, click the Global Elements tab.
  7. Double-click the Salesforce global element to open its Global Element Properties panel. In the Security Token field, paste the new Salesforce token you copied from the email. Alternatively, configure the global element in the XML Editor.
  8. Change the contents of the Username and Password fields to your account-specific values, then click OK to save your changes.
  9. In the Package Explorer, right-click the connect-with-salesforce project name, then select Run As > Mule Application. Studio runs the application on the embedded server.
  10. This project includes a sample CSV file, called leads.csv, that you can use to witness end-to-end functionality of the application. In the Package Explorer, click the src/main/resources folder to expand it, then find the leads.csv file inside this folder.
  11. Copy the leads.csv file into an input folder in the same directory.
  12. The File connector in the application polls the input folder every ten seconds. It picks up the CSV file, processes it, then deposits it into the output folder in the same directory. (Hit F5 to refresh the contents of the input and output folders.)
  13. In your browser, access your Salesforce account, then navigate to the Leads tab.
  14. Use the drop-down menu to display All Open Leads, then scan your leads for the new entries:
    • Ishmael Alexander
    • Cole Burks
  15. Stop the Mule application by clicking the square, red terminate button in the Console.
  16. Delete the two sample leads from your Salesforce account.


Import Leads into Salesforce using Batch Processing doesn't have any reviews yet
Created byMuleSoft Organization
Published onSep 6, 2018
Asset overview

Asset versions for 2.1.x

VersionRuntime versionActions


SalesforceNo values left to add