This example uses pre-packaged tools to intelligently connect with Salesforce.
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.
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.
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 Salesforce field.
Create, then run this example in your own instance of Anypoint Studio.
Sfdcconfig 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.
contacts.csv, that you can use to view the end-to-end functionality of this application. In the Package Explorer, click the
src/main/resourcesfolder to expand it, then find the
contacts.csvfile inside this folder.
import-contacts-into-salesforceproject, then select Run As > Mule Application. Studio runs the application on the embedded server.
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.
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:
To export auto-generated Studio documentation, select a project from the Package Explorer, and choose File > Export Studio Documentation from the main toolbar.
|Published on||Sep 6, 2018|