Import Contacts Into Salesforce icon

Import Contacts Into Salesforce

(0 reviews)

home

At times, you may find that you need to connect one or more of your organization's on-premises systems with a SaaS such as Salesforce. Ideally, these independent systems talk to each other and share data to enable automation of end-to-end business processes. Use Mule applications to facilitate communication between your on-premises systems and Salesforce. Although this use case does not extend as far, you can also use Mule to facilitate communication between SaaS providers.

screenshot from Anypoint Studio

Example

Though a simple example, this application nonetheless employs complex functionality to demonstrate a basic use case. The application accepts CSV files which contain contact information – name, phone number, email – and uploads them into a Salesforce account, automatically inserting the correct data into each Salesforce field.

Set Up and Run the Example

Complete the following procedure to create, then run this example in your own instance of Anypoint Studio. Skip ahead to the next section if you prefer to simply examine this example via code snippets.

  1. Create the example application in Anypoint Studio. 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 contacts.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 contacts.csv file inside this folder.
  11. Click and drag the contacts.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 Contacts tab.
  14. Use the drop-down menu to display All Contacts, then scan your contacts for three new entries:
    • Charles Bingley
    • Fitzwilliam Darcy
    • George Wickham
  15. Stop the Mule application by clicking the square, red terminate button in the Console.
  16. Delete the three sample contacts from your Salesforce account.

Documentation

Read full documentation in GitHub

Examples to Try Next

If you understood this example
Web Service Consumer - Learn how to consume an existing Web service.View
If you struggled with this example
HTTP Request Response with Logger - Learn how to use Mule to build a simple HTTP request-response application.View

Reviews

TypeExample
OrganizationMulesoft Inc.
Published by
MuleSoft Organization
Published onMar 17, 2018
Asset overview

Asset versions for 1.4.x

Asset versions
VersionActions
1.4.0