Salesforce to Microsoft Dynamics Account Broadcast

(0 reviews)


Broadcasts changes to accounts in Salesforce to Microsoft Dynamics in real time. The detection criteria, and fields to move are configurable. Additional systems can be added to be notified of the changes. Real time synchronization is achieved via rapid polling of the Salesforce instance.

This template uses batch processing and watermarking capabilities within the Anypoint Platform to efficiently process many records.


License Agreement

This template is subject to the conditions of the MuleSoft License Agreement. Review the terms of the license before downloading and using this template. You can use this template for free with the Mule Enterprise Edition, CloudHub, or as a trial in Anypoint Studio.

Use Case

As a Salesforce admin I want to migrate Contacts from Salesforce to MS Dynamics.

This template serves as a foundation for setting an online sync of Contacts from Salesforce instance to MS Dynamics instance. Every time there is a new Contact or a change in an already existing one, the integration will poll for changes in Salesforce source instance and it will be responsible for creating or updating the Contact in the target MS Dynamics instance.

Requirements have been set not only to be used as examples, but also to establish a starting point to adapt your integration to your requirements.

As implemented, this template leverages the Mule batch module.

The batch job is divided in Process and On Complete stages.

The integration is triggered by a scheduler defined in the flow that is going to trigger the application, querying newest Salesforce updates or creates matching a filter criteria and executes the batch job.

During the Process stage, each Salesforce Contact is checked, if it has an existing matching Contact in the MS Dynamics instance.

The last step of the Process stage inserts or updates Contacts in MS Dynamics.

Finally during the On Complete stage the Template logs output statistics data into the console.


To make this template run, there are certain preconditions that must be considered. All of them deal with the preparations in both, that must be made for the template to run smoothly. Failing to do so could lead to unexpected behavior of the template.

Salesforce Considerations

Here's what you need to know about Salesforce to get this template to work:

As a Data Source

If the user who configured the template for the source system does not have at least read only permissions for the fields that are fetched, then an InvalidFieldFault API fault displays.

java.lang.RuntimeException: [InvalidFieldFault [ApiQueryFault 
[ApiFault  exceptionCode='INVALID_FIELD'
exceptionMessage='Account.Phone, Account.Rating, Account.RecordTypeId, 
ERROR at Row:1:Column:486
No such column 'RecordTypeId' on entity 'Account'. If you are attempting 
to use a custom field, be sure to append the '__c' after the custom field 
name. Reference your WSDL or the describe call for the appropriate names.'

Microsoft Dynamics CRM Considerations

As a Data Destination

There are no considerations with using Microsoft Dynamics CRM as a data destination.

Run it!

Simple steps to get this template running.

Running On Premises

In this section we help you run this template on your computer.

Where to Download Anypoint Studio and the Mule Runtime

If you are new to Mule, download this software:

Note: Anypoint Studio requires JDK 8.

Importing a Template into Studio

In Studio, click the Exchange X icon in the upper left of the taskbar, log in with your Anypoint Platform credentials, search for the template, and click Open.

Running on Studio

After you import your template into Anypoint Studio, follow these steps to run it:

  • Locate the properties file, in src/main/resources.
  • Complete all the properties required as per the examples in the "Properties to Configure" section.
  • Right click the template project folder.
  • Hover your mouse over Run as.
  • Click Mule Application (configure).
  • Inside the dialog, select Environment and set the variable mule.env to the value dev.
  • Click Run.

Running on Mule Standalone

Update the properties in one of the property files, for example in, and run your app with a corresponding environment variable. In this example, use mule.env=prod.

Running on CloudHub

When creating your application in CloudHub, go to Runtime Manager > Manage Application > Properties to set the environment variables listed in "Properties to Configure" as well as the mule.env value.

Deploying a Template in CloudHub

In Studio, right click your project name in Package Explorer and select Anypoint Platform > Deploy on CloudHub.

Properties to Configure

To use this template, configure properties such as credentials, configurations, etc.) in the properties file or in CloudHub from Runtime Manager > Manage Application > Properties. The sections that follow list example values.

Application Configuration

Batch Aggregator Configuration

  • page.size 200

Scheduler Configuration

  • scheduler.frequency 10000
  • scheduler.start.delay 100

Watermarking default last query timestamp for example, 2018-12-13T03:00:59Z

  • watermark.default.expression YESTERDAY

Salesforce Connector Configuration

  • sfdc.username joan.baez@orgb
  • sfdc.password JoanBaez456
  • sfdc.securityToken ces56arl7apQs56XTddf34X

MS Dynamics Connector Configuration

  • msdyn.user msdyn_user
  • msdyn.password msdyn_password
  • msdyn.url https://{your MS Dynamics url}
  • msdyn.retries 5

API Calls

Salesforce imposes limits on the number of API Calls that can be made. However, in this template, only one call per poll cycle is done to retrieve all the information required.

Customize It!

This brief guide provides a high level understanding of how this template is built and how you can change it according to your needs. As Mule applications are based on XML files, this page describes the XML files used with this template. More files are available such as test classes and Mule application files, but to keep it simple, we focus on these XML files:

  • config.xml
  • businessLogic.xml
  • endpoints.xml
  • errorHandling.xml


This file provides the configuration for connectors and configuration properties. Only change this file to make core changes to the connector processing logic. Otherwise, all parameters that can be modified should instead be in a properties file, which is the recommended place to make changes.


Functional aspect of the template is implemented on this XML, directed by one flow that will poll for Salesforce creations/updates. The several message processors constitute four high level actions that fully implement the logic of this template:

  1. Firstly the template queries Salesforce for all the existing Contacts that match the filter criteria.
  2. During the Process stage, each Contact Name is checked in Fullname field in MS Dynamics, if it has an existing matching Contact in MS Dynamics.
  3. Then, according to the result of the second step, the update or create is performed in MS Dynamics.
  4. Finally during the On Complete stage the template logs output statistics data into the console.


This file is conformed by a Flow containing the Scheduler that will periodically query Salesforce for updated/created Contacts that meet the defined criteria in the query and then executing the batch job process with the query results.


This file handles how your integration reacts depending on the different exceptions. This file provides error handling that is referenced by the main flow in the business logic.


Salesforce to Microsoft Dynamics Account Broadcast doesn't have any reviews yet
Created byMuleSoft Organization
Published onOct 10, 2018
Asset overview

Asset versions for 2.1.x

VersionRuntime versionActions


BroadcastNo values left to add
SalesforceMicrosoftNo values left to add