Salesforce – D365 Integration

User friendly interface

Microsoft Dynamics 365 offers business solutions in different business processes such as Finance & Operations. For connecting salesforce to D365 Azure APIM and Azure Analytics is used to send data from salesforce to D365.

APIM (Azure API Management) is a hybrid, multicloud management platform for APIs across all environments. As a platform-as-a-service, API Management supports the complete API lifecycle. And Analytics simplifies big data. APIM and Analytics is used to manage api’s and data for D365.

In this Salesforce – D365 Integration blog we are going to elaborate the integration of the Salesforce object with the D365 object. The field mappings between the Salesforce Object and the D365 object is done by the D365 technical team when data is sent from salesforce to D365. And for getting updated data from D365 to salesforce we use standard api’s of salesforce for which we do not require any field mapping and code.

Working of the Salesforce – D365 Integration

  • Whenever an Account record gets created/updated in salesforce and approved in Salesforce, it is sent to D365.
  • Updated information comes from D365 to Salesforce.

Technical Approach taken for Integration from Salesforce to D365

  • Prerequisite to start the Salesforce-D365 Integration

    • Configure Remote Site setting in salesforce.
    • D365 Endpoint Api for sending data.
    • D365 Subscription key for Authorization.
  • Apex Code to push the data from salesforce to D365.

Use the following code in Apex Class to push the Salesforce data into the Microsoft Dynamics 365(D365):

Http http = new Http(); HttpRequest request = new HttpRequest(); request.setEndpoint(‘Push URL of D365’); request.setMethod('POST'); request.setHeader('Content-Type', 'application/json;charset=UTF-8'); request.setHeader('Ocp-Apim-Subscription-Key', ‘Subscription Key of D365’); request.setBody(JSONbody); HttpResponse response = http.send(request); system.debug('response getStatusCode=======' +response.getStatusCode());

After executing the Apex Class, if Request is sent to D365 successfully, you will find 200 as the status code from D365.

Technical Approach taken for Integration from D365 to Salesforce

  • Prerequisite to start the D365 - Salesforce Integration

    • Create a connected App in salesforce, and share information regarding ClientId, Client Secret, Username, Password, Access Token of salesforce to D365 technical team.
    • Share Standard Api’s of Salesforce objects with D365.
  • There is no Apex Code required for data coming from D365 to salesforce because of the standard Salesforce API’s.


Salesforce Integration with D365 is a two way healthy integration. In this integration for sending data from Salesforce to D365 we use custom coding with the help of which we hit the API’s defined by D365 and send data to salesforce. And for receiving data from D365 to salesforce we use Standard Salesforce API’s with the use of these API’s we do not require any coding at the Salesforce side.