Please note that this document is still a work-in-progress.
When your organization creates new account in Salesforce, you might want to create the same account in Microsoft Dynamics CRM as well.
In this guide, we explain how to use the Salesforce REST connector to get details of your new accounts (e.g., Id, name and etc) from Salesforce, use the Microsoft dynamics CRM connector to add that information to Microsoft Dynamics CRM and then send an email alert regarding the data lost to the relevant stakeholders (in this case, of any failiures) using the Gmail connector.
How the solution works
The following diagram illustrates how the basic solution works:
- Get the account details from Salesforce using the query operation (poll using scheduled tasks).
- Add the account details to a Microsoft Dynamics CRM using the createEntity operation.
The following diagram illustrates how can we send a mail alert to user when any data lost in Microsoft Dynamics CRM due to any failures. Sending Email Alerts is optional and can be configured if required by having the True value for the property "gmail_alert_to_user"
- Send an email to managers using the Gmail connector's sendMail operation.
Before you begin, follow the guides below to set up Microsoft Dynamics CRM, Salesforce and Gmail:
- Get Credentials from Microsoft Dynamics CRM
- Get Credentials from Salesforce
- Get Credentials from Gmail
Follow the guides below to create mysql database to store the time stamp value (System time).
Before you begin, As mentioned in this guide, follow the section "Configuring mysql credentials and database" to modify this CAR file. Because you need to change the mysql credentials, database name and table name as used in the previous step.
Let's get started.
- Go to WSO2 Cloud and sign up if you haven't done so already. The UI guides you through the sign-up process.
- Sign in to WSO2 Cloud and select the Integration Cloud from the list of Clouds that are available.
- The Integration Cloud opens. Click CREATE APPLICATION.
- Click WSO2 ESB Composite Application.
- Select the Local File System option and click Continue.
Give an application name (e.g., SalesforceToMsDynamics) and upload this CAR file.
What is a CAR file? A Composite Application (CAR) is an archive file that has the collection of artifacts that you want to deploy in a WSO2 product instance. These artifacts are usually JAVA-based or XML configurations, designed differently for each product in the WSO2 Carbon platform. You can deploy these artifacts to generate services.
You link to the Salesforce and the Microsoft Dynamics CRM account that you use in this scenario using environment variables. Download this file and change the values of the variables according to your requirements.Click here to read more information about the environment variables used in this file...
"salesforcerest_accessToken" : "00D7F000001bgeT!ARkAQMIj3BLrLwW74YIY8cP50SKAWc3k",
"salesforcerest_apiUrl" : "https://ap5.salesforce.com",
"salesforcerest_apiVersion" : "v32.0",
"salesforcerest_hostName" : "https://login.salesforce.com",
"salesforcerest_clientSecret" : "##############",
"salesforcerest_clientId" : "#############################",
"salesforcerest_refreshToken" : "5A613hy0tHCYdhxrWr6MmIbH3FIe4l4lFddmjfLo.K1aIgVEfrgfrACD59HVcUdJzdwefewfewfHI6WyI",
"salesforcerest_registryPath" : "connectors/salesforcerest",
"msdynamics365_apiUrl" : "https://wso2438.crm5.dynamics.com",
"msdynamics365_refreshToken" : "AQABAAAAAAA9kTklhVy7SJTGAzR-VStVQG3uxgpqTvz8_dA6VrUgAA",
"msdynamics365_apiVersion" : "v8.2",
"msdynamics365_resource" : "https://wso2438.crm5.dynamics.com/",
"msdynamics365_clientSecret" : "te576hyjhjk/MkEotJsF8MIleWQdEovHBoprpH9I=",
"msdynamics365_clientId" : "2972350d-yuio-4614-9ac1-detreyhu",
"gmail_to" : "firstname.lastname@example.org",
"gmail_from" : "email@example.com",
"gmail_alert_to_user" : "true"
Here's a description of the properties:
- salesforcerest_accessToken: access token from salesforce account.
- salesforcerest_apiUrl : The apiUrl to access the salesforce REST api.
- salesforcerest_apiVersion : The version of salesforce REST api.
- salesforcerest_hostName : SalesforceOAuth endpoint when issuing authentication requests in your application.
- task_interval_time : The interval time of the scheduled task in seconds(default 120 seconds).
- salesforcerest_clientSecret : Value of your client secret given when you registered your application with Salesforce.
- salesforcerest_clientId : Value of your client ID given when you registered your application with Salesforce.
- salesforcerest_refreshToken : Value of your client secret, which can be obtained at Google developer console.
- salesforcerest_registryPath :Registry path of the connector where the values are stored. You must give the value as :
- msdynamics365_apiUrl : The API URL of Microsoft Dynamics 365 Web API.
- msdynamics365_accessToken : The value of the access token to access the Microsoft Dynamics 365 Web API via request.
- msdynamics365_apiVersion : The API version of the Microsoft Dynamics 365 (v8.2).
- msdynamics365_refreshToken: An OAuth 2.0 refresh token. The application can use this token to acquire other access tokens after the current one is expires.
- msdynamics365_resource : The App ID URI of the web API (E.g., "https://kavi859.crm5.dynamics.com/).
- msdynamics365_clientSecret: The secret key of the application that is registered in the Azure AD.
- msdynamics365_clientId : The client ID of the client application that is registered in Azure AD.
- gmail_to : The email address of stakeholder to whom the data lost alert will send
- gmail_from : The email address from whom the email sent.
- gmail_alert_to_user : Optional - If the value is true then email alert will send to stake holder regarding data lost , otherwise not.
- salesforcerest_accessToken: access token from salesforce account.
- Click the Advanced Setting... link, expand the Environment Variables section, and upload this JSON file that you created in the previous step.
- Click the Create button at the end of the form to complete creating the application.
Note that you see the application's Overview page once the application is deployed in the Cloud.
You have now created an application in WSO2 Integration Cloud. Let's see how to test the scenario.
.Go to Salesforce and create a new account and note the following same account records in the Microsoft Dynamics CRM :
Create a new account (First Test Account) in salesforce :
You can find the new Account Entity with name First Test Account in your Microsoft Dynamics CRM.
You have now used the WSO2 connectors in the Connector store to create Account Entity in Microsoft Dynamics CRM with Salesforce Accounts details.
Want to customize the default use case?
In this guide, you tried the solution on WSO2 Integration Cloud. You can do the same on-premise, with your own WSO2 Enterprise Integrator instance. To change the default use case in cases such as customizing the information that you retreive from Salesforce, editing the default email template, default time duration of the scheduled tasks, see Modify the Default Integration Scenario.