Learned by Doing: How to create and use a Microsoft Dynamic CRM custom entity with Talend components

Overview

This article discusses the difference between CRM on Premise and Cloud, then focuses on the usage of Talend with Microsoft Dynamic CRM in general but with cloud in particular. For a cloud connection, it will show how to create the native application and get all the value for the field that are needed.

 

Prerequisite

To create a Microsoft Dynamic CRM custom entity, you must have a Microsoft Dynamic CRM administration account.

 

CRM on Premise vs Online

What is the difference?

CRM Online: This is a SaaS model. If you choose CRM Online, this means that your CRM system will be in Microsoft’s Cloud.

Benefits of CRM Online

  • You get immediate access to new features for Dynamics CRM as soon as they are released. Microsoft currently releases two major updates a year for CRM Online.
  • You will get some features that are ONLY available in CRM Online.
  • No falling behind on versions—Microsoft requires you to update regularly, which prevents you from falling multiple versions behind. This prevents a large and time-consuming upgrade project in the future.
  • Less upfront and ongoing costs because you don’t need the IT infrastructure or maintenance.
  • With online hosting, you pay a monthly fee instead of paying all at once. It requires less cash up front.
  • CRM Online is secure and reliable, and has a super-robust disaster recovery scenario that few on-premises customers can afford to create.

 

CRM On-premise: This traditional mode is where CRM is hosted by your company or by another hosting partner/vendor.

Benefits of CRM On-premise

  • You have access to the SQL database.
  • You have the ability to run SQL queries and reports.
  • If you run into performance issues, you can add more hardware for it since you are responsible for the infrastructure.
  • You decide precisely when and if you want to upgrade.
  • You can run old code that does not run in CRM online.
  • You decide on, and have control of, security and setup.

Step by step Azure Native application creation

To connect Talend Studio with Microsoft CRM cloud version, you need to create a native application that you will use in your Talend component to be able to connect. Below are the steps:

 

  1. Log in to the Azure portal: https://portal.azure.com.

     

  2. Enter the username and password, then the screen of Microsoft Azure screen appears. InkedInkedc3_LI.jpg

     

  3. Click Azure Active Directory.

     

  4. Click App registrations. Inkedc4_LI.jpg

     

  5. Click New application registration. InkedInkedc5_LI.jpg

     

  6. Click Create to create a Native Web App. Enter a Name (for example, kb_test_native_app1), click the drop-down and choose Native, then enter the Redirect URI (for example, http://localhost)

    c6.png

     

  7. Click Create to create a Native App.

     

  8. Scroll down then click kb_test_native_app1. InkedInkedc7_LI.jpg

     

  9. Click Required permissions.

    c8.png

    The Application ID is shown above. You will need it in the tMicrosoftCrmInput/tMicrosoftCrmOutput components to connect CRM 2016 ODATA.

     

  10. Click Grant Permissions to grant access permission.

    c9.png

     

  11. Click Add to add application.

    c10.png

     

  12. Click Select an API, then choose Dynamics CRM Online to add Dynamics CRM Online.

    c11.png

     

  13. Click Select, then Done.

     

  14. Check the box next to Access CRM Online as organization users.

    c12.png

     

  15. Click Select, then Done.

    c13.png

     

  16. Permission is granted for the Windows Azure Active Directory and Dynamics CRM Online.

    c14.png

    After all these steps you are set to connect to your CRM in cloud using your username, password and the application ID that you just created. But to insert data into your custom entity you need to create and grant all the needed permissions, as shown in the next steps.

Create a CRM custom entity

Once you are done with the application creation, follow these steps to create the custom entity that you will be using.

Note: Assume you already have an online Microsoft Dynamics CRM account access granted.

 

  1. Log into Office by clicking on the URL https://www.office.com

     

  2. Click Open the app launcher to access Office 365 apps.

    p1.png

     

  3. Click Get more apps.

    p2.png

     

  4. Click Dynamics 365 to add a Dynamics CRM.

    p3.png

     

  5. Login into the Dynamics CRM by copying and pasting the URL https://home.dynamics.com/.

     

  6. Click Dynamics 365.

    p4.png

     

  7. After logging in, click the drop-down arrow in Sales:

    c15.png

     

  8. Click Settings.

    c18.png

     

  9. Click Customizations.

    c19.png

     

  10. Click Customize the System.

    c20.png

     

  11. A new window will appear as shown below:

    Capture1.PNG

     

  12. Expand the arrow next to Entities:

    Capture2.PNG

     

  13. Click the drop-down arrow next to New, then choose Entity.

    Capture3.PNG

     

  14. The following window will appear. Fill in the entity name and the display and permission as shown below:

    c24.png

     

  15. Then click Save and close.

     

Create custom fields

  1. Scroll down and expand the entity just created (for example, test_employee2).

    c25.png

     

  2. Click Fields, then click New.

    c26.png

     

  3. Enter the field name (for example, firstname), the data type, and the field type. Click Save and New to create another field name.

    c27.png

     

  4. Name the new field lastname, then click Save and Close.

     

  5. You will see that the two new fields you just created are highlighted:

    c29.png

 

Create forms

  1. Click Forms, then click New > Main Form.

    c30.png

     

  2. The New Form window will appear. Drag firstname and lastname from the Field Explorer on the right to the General pane as shown below:

    Inkedc31_LI.jpg

     

  3. Click the entity you just created (test_employee2) then click Publish to publish the entity.

    c32.png

     

 

Set access permissions for the custom entity

  1. Click the checkbox next to Access Teams to set the access permission for the test_employee2 entity.

    c33.png

     

  2. Check that test_employee2 appears in Sales.

    c34.png

 

How to connect Talend to your CRM?

The following example discusses the online scenario with 2011 and 2016 just to illustrate. The connection to your on-premise CRM will just require the credentials and host to connect.

 

Connection to online Microsoft Dynamic CRM 2011

To connect, drag and drop your CRM component and fill out the requirement field. But behind the scenes, the following points are what you need to know:

  • When you enter the password in the UI, it encrypts and decrypts the password.
  • It collects the username, organizeName, and encrypted password, then invokes the MSCRMClient object and passes the credentials to it.
  • It collects the service endpoint URL from the UI, invokes the MSCRMClient.getOnlineConnection(), then passes the service endpoint URL to it.
  • The org.talend.ms.crm.MSCRMClient object collects all above credentials, then invokes the Microsoft authenticate method in the SecurityData object to connect to the Microsoft Dynamics CRM 2011.

    c1.png

     

Connection to online Microsoft Dynamic CRM 2016 (ODATA connection)

Here Talend will be using the ODATA protocol to communicate with your CRM. Below are what is happening behind the scenes:

  • When you enter the password in the UI, it encrypts and decrypts the password.
  • It collects the Application ID, username, decrypted password, and the authorization endpoint, then passes them into the org.talend.ms.crm.odata.ClientConfiguration constructor for setting. The org.talend.ms.crm.odata.ClientConfiguration object is the set class.
  • It invokes the org.talend.ms.crm.odata.DynamicsCRMClient object, then passes it in the class variable, the Service Root URL, and the entity name (for example, accounts).
  • The org.talend.ms.crm.odata.DynamicsCRMClient object invokes the Microsoft AuthenticationContext.acquireToken() to get the connection. Inkedc2_LI.jpg

 

Talend with CRM: Example Job

CRM 2011

  1. Input column names in the schema to write data to the new_test_employee2 custom entity.

    c35.png

     

  2. Job output:

    c37.png

     

 

CRM 2016 ODATA: Using the application created

  1. Write data to CRM 2016 ODATA:

    c42.png

     

  2. Job output:

    c43.png

     

  3. Read data from CRM 2016 ODATA:

    c44.png

     

  4. Job output

    c45.png

 

Debugging tips

For any connection issues you may encounter during your testing, below are a few pointers that can help you in your debugging:

 

Online Microsoft Dynamics CRM 2011

  • Verify Microsoft Dynamics CRM access permission.
  • Verify the login credentials such as username, password, and OrganizeName.
  • Verify the Discovery service endpoint URL.

 

Online Microsoft Dynamics CRM 2016 (ODATA)

  • Verify Microsoft Dynamics CRM access permission.
  • Verify the Application ID.
  • Verify the service root URL.
  • Verify the OAuth authorization endpoint URL.
  • Increase the Time out.

On Premise CRM

  • Verify the WebService URL.
  • Verify the login credentials such as username, password, and OrganizeName.
  • Verify the domain, host, and the port number.
Version history
Revision #:
34 of 34
Last update:
‎09-29-2018 12:15 AM
Updated by:
 
Labels (3)