Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

12/11/2023, 14:18 Import Contacts Into Salesforce

Exchange Sis Consultoria PJ

Go to assets list

Import Contacts Into Salesforce Download

Example MuleSoft Updated 4 years ago

MuleSoft Organization published 5 years ago View versions 2.1.x

Categories (3) Latest 2.1.4 Stable

PAGES

Home

Helpful Links

https://anypoint.mulesoft.com/exchange/org.mule.examples/import-contacts-into-salesforce/minor/2.1/ 1/5
12/11/2023, 14:18 Import Contacts Into Salesforce

This example uses pre-packaged tools to intelligently connect with Salesforce.


Exchange Sis Consultoria PJ

Based on a simple use case, the application takes a CSV file of contacts and uploads the contact information to an active
Salesforce org. It uses DataSense and Anypoint DataWeave to map and transform data, thereby facilitating quick
integration with this Software as a Service (SaaS) provider.

Connecting with Salesforce


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-prem system(s) and Salesforce.

This example doesn't include an example of SaaS-to-SaaS communication, however, you can also use Mule for this
purpose.

Assumptions
You are familiar with Mule and the Anypoint™ Studio interface. To increase your familiarity with Studio. If you aren't
yet familiar with these items, skip the next section "Set Up and Run the Example" to examine this application's code
snippets.
You have a basic understanding of Mule flows, Mule Global Elements, and Anypoint DataWeave.

Thi li ti l l f ti lit t d t t b i Th li ti t CSV fil hi h


https://anypoint.mulesoft.com/exchange/org.mule.examples/import-contacts-into-salesforce/minor/2.1/ 2/5
12/11/2023, 14:18 Import Contacts Into Salesforce
This application employs complex functionality to demonstrate a basic use case. The application accepts CSV files which
contain contact information and uploads it into a Salesforce account, automatically inserting the correct data into each
Exchange Sis Consultoria PJ
Salesforce field.

Set Up and Run the Example


Create, then run this example in your own instance of Anypoint Studio.

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 Sfdc config 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. This project includes a sample CSV file, contacts.csv , that you can use to view the end-to-end functionality of
this application. In the Package Explorer, click the src/main/resources folder to expand it, then find the
contacts.csv file inside this folder.
10. Double-click the File config tab in the Global Elements tab and set the Working Directory field to point to the
src/main/resources folder.
11. In the Package Explorer, right-click the import-contacts-into-salesforce project, then select Run As > Mule
Application. Studio runs the application on the embedded server.
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. Hint: tap the F5 key to refresh the contents of 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 two new entries: John Doe and Jane
Doe.
15. Stop the Mule application by clicking the red square terminate button in the console.
16. Delete the three sample contacts from your Salesforce org.
https://anypoint.mulesoft.com/exchange/org.mule.examples/import-contacts-into-salesforce/minor/2.1/ 3/5
12/11/2023, 14:18 Import Contacts Into Salesforce
16. Delete the three sample contacts from your Salesforce org.

Exchange Sis Consultoria PJ


How it Works
Using a single flow with three elements, this application accepts CSV files which contain contact information, then uploads
the contacts to Salesforce.

The File Connector polls the input folder for new files every ten seconds. When it spots a new file, it reads it and passes the
content to DataWeave. This transformer not only converts the format of the data from CSV to a collection, it automatically
maps the input fields from the CSV file, FirstName, LastName, etc., to output fields that Salesforce uses in a collection.
When the application has converted all the contacts in the file into a Salesforce-friendly collection, it uses a Salesforce
Connector to push data into a Salesforce org. The connector's configurations specify the operation Create and the sObject
type Contact. These specifications control how the data is uploaded to Salesforce. In this case, it creates new contacts.

While the application's functionality is straightforward, it uses a powerful Mulesoft tool, DataSense. Rather than building
the application by adding and then configuring each of the elements manually according to the order in which they
appear in the flow, DataSense completes the most difficult configurations automatically.

Project Documentation
Studio includes a feature that enables you to easily export all the documentation you have recorded for your project.
Whenever you want to share your project with others outside the Studio environment, you can export the project's
documentation to print, email or share online. Studio's auto-generated documentation includes:

A visual diagram of the flows in your application


The XML configuration which corresponds to each flow in your application
The text you entered in the Notes tab of any building block in your flow

To export auto-generated Studio documentation, select a project from the Package Explorer, and choose File > Export
Studio Documentation from the main toolbar.

Reviews
https://anypoint.mulesoft.com/exchange/org.mule.examples/import-contacts-into-salesforce/minor/2.1/ 4/5
12/11/2023, 14:18 Import Contacts Into Salesforce

PJ Be the first to review Import Contacts Into Salesforce 2.1.x


Exchange Sis Consultoria PJ

https://anypoint.mulesoft.com/exchange/org.mule.examples/import-contacts-into-salesforce/minor/2.1/ 5/5

You might also like