The underlying use case of the Export Salesforce Account Details to Microsoft Dynamics CRM scenario is that you get details of your new accounts in Salesforce and add them to Microsoft Dynamics CRM. This section explains how to modify this default scenario as follows:
- Change the information that you retrieve from Salesforce about new accounts.
- Change the default time duration for the scheduled task that checks whether new accounts are created.
- Edit the default email template that you send to stakeholders in case of a failure.
- Retrieve the data that were created after a timestamp that you mention. You can set any timestamp in the past to see data that might have been lost due to a failure in the system.
Let's get started.
Download and install WSO2 EI tooling.
Download the content of this GitHub location to a suitable location in your machine.
Open the EI tooling interface. The workspace is any folder in your local file system where your tooling artifacts will be saved. For example,
- Once the workspace opens, click the File -> Import menu from the menu bar and then under the General drop-down, click Existing Projects into Workspace.
- Select the source folder that you downloaded earlier in step 2 as the root directory, select all the projects inside the directory, and click Finish.
Let's import the required connectors to the project.
- Right click
SalesforceToMsDynamicsand click Add or Remove Connector.
- Select Add connector and click Next.
Connect to the WSO2 Store using the Connector store location option and select the following connectors from the list once the available connectors load.
Microsoft Dynamics 365
You have now created a tooling project using the downloaded artifacts. Next, let's modify the artifacts to our requirements.
Modify the project's artifacts
SalesforceToMsDynamicsin the left navigation and Note that the project's artifacts open in the tooling interface as follows:
Open the sequence
sampleRequest.xmlunder synapse-config -> sequences.
Tip: See Working with sequences for information about sequences.
To change the information that you retrieve from Salesforce about new accounts, go to the Source tab and modify the salesforce query given below:
Tip: For more information about salesforce.query, see Querying records.
To change the default email template, go to the Source tab of
sampleRequest.xmland modify the following code as you want.
By default, we have set the scheduled task to fetch new accounts from Salesforce in every 120 seconds. This is done for testing purposes. But, in a real business environment, you might want to increase this value.
To change the time duration of the scheduled task, open the
SalesforceToMsDynamics.xmlfile that is under synapse-config -> tasks and change the value of the Interval property.
Tip: If you change the schedule task time here, be sure to change the task_interval_time property with the same value in environment variables also.
Tip: For more information on scheduled tasks, see creating a scheduled task.
To get all the issues that are created after a timestamp that you specify, create a mysql database to store the timestamp.
There is a scheduled task that polls Salesforce and collects data that is created after a timestamp value that is in the database. After each poll, the sceduled task updates the timestamp value to the current time so that the next time it polls, it will retreive only the newer data. However, you might sometimes want to see old data that might be lost due to a system failure.Click here for information on how to create a database to store the timestamp...
You can create a database and store the timestamp value in it. The timestamp is in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
- Log in to WSO2 Integration Cloud by going to http://wso2.com/cloud/, clicking the Sign In link and then selecting WSO2 Integration Cloud.
- The Integration Cloud opens. Click CREATE DATABASE.
- Enter the following information in the form that opens, scroll down, and click Create Database.
- Database Name: salesforceToMsdynamics
- Default User Name: admin
Give a suitable password
The database that you just created opens on the console. Copy the database name, URL, and username.
You see additional characters in the database name and username because the Integration Cloud adds them to uniquely identify the tenant of the database and the user.
Assuming you already have MySQL Server installed in your local environment, go to the command-line or terminal, type
enterto go to the MySQL prompt, and then execute the following commands to connect to the MySQL database that you just created.
The following commands are an example. You can change the database name, table name, column name and Timestamp value as you want.
Back in the Tooling interface, open the sequence
sampleRequest.xmlthat is under synapse-config -> sequences and replace its code with this code.
Modify the following code blocks in your code with your mysql credentials, database URL, driver, table name, and column name.
Once you are done modifying the default scenario, right click
SalesforceToMsDynamicsand click Export Composite Application Project. You will then be promped to save the project's artifacts as a CAR file.