Site Tools


Hotfix release available: 2025-05-14b "Librarian". upgrade now! [56.2] (what's this?)
Hotfix release available: 2025-05-14a "Librarian". upgrade now! [56.1] (what's this?)
New release available: 2025-05-14 "Librarian". upgrade now! [56] (what's this?)
Hotfix release available: 2024-02-06b "Kaos". upgrade now! [55.2] (what's this?)
Hotfix release available: 2024-02-06a "Kaos". upgrade now! [55.1] (what's this?)
New release available: 2024-02-06 "Kaos". upgrade now! [55] (what's this?)
Hotfix release available: 2023-04-04b "Jack Jackrum". upgrade now! [54.2] (what's this?)
Hotfix release available: 2023-04-04a "Jack Jackrum". upgrade now! [54.1] (what's this?)
New release available: 2023-04-04 "Jack Jackrum". upgrade now! [54] (what's this?)
Hotfix release available: 2022-07-31b "Igor". upgrade now! [53.1] (what's this?)
Hotfix release available: 2022-07-31a "Igor". upgrade now! [53] (what's this?)
New release available: 2022-07-31 "Igor". upgrade now! [52.2] (what's this?)
New release candidate 2 available: rc2022-06-26 "Igor". upgrade now! [52.1] (what's this?)
New release candidate available: 2022-06-26 "Igor". upgrade now! [52] (what's this?)
Hotfix release available: 2020-07-29a "Hogfather". upgrade now! [51.4] (what's this?)
New release available: 2020-07-29 "Hogfather". upgrade now! [51.3] (what's this?)
New release candidate 3 available: 2020-06-09 "Hogfather". upgrade now! [51.2] (what's this?)
New release candidate 2 available: 2020-06-01 "Hogfather". upgrade now! [51.1] (what's this?)
New release candidate available: 2020-06-01 "Hogfather". upgrade now! [51] (what's this?)
Hotfix release available: 2018-04-22c "Greebo". upgrade now! [50.3] (what's this?)
Hotfix release available: 2018-04-22b "Greebo". upgrade now! [50.2] (what's this?)
microsoft_dynamics_crm_integration

Microsoft Dynamics CRM Integration

Microsoft Dynamics provides the following applications:

  1. Enterprise Resource Planning (ERP)
  2. Customer Relationship Management (CRM)

We are going to make use of CRM to fetch and update all the user details in Learnexa. CRM fundamentals include:

  1. Centralize customer information
  2. Provide business intelligence
  3. Analyze data
  4. Enable responsive customer service

Workflow Diagram

Create an account in MS Dynamics CRM

  1. Visit the following site and sign up a free trail https://www.microsoft.com/en-us/dynamics/free-crm-trial.aspx
  2. This will create a site with the organization name provided during free trial setup
  3. Free trial site created for test purpose:
    1. Username: yamini@testdynamics3650.onmicrosoft.com

Query CRM with Web API calls

Authenticate API via ADAL(Azure Active Directory Library)

  1. Create an app under Azure Active Directory, which will provide client id and authorisation server tenant
    1. Steps to create an azure account and register an app are provided in this link: https://debajmecrm.com/2016/02/23/understanding-in-depth-cross-origin-resource-sharing-cors-in-dynamics-crm-2016/
  2. Make an API call to https://login.windows.net/common providing the Organization UI and client ID, which will return an access token that can be used for other API calls
resource: https://testdynamics3650.crm8.dynamics.com

clientId: d0835aea-3d68-462f-91a7-38edbbe4ab6f

tenant: crmdynamicsad.onmicrosoft.com

redirectUrl: http://localhost:3000/dynamics_crm/authenticate

request url: https://login.windows.net/crmdynamicsad.onmicrosoft.com/oauth2/authorize or (https://login.windows.net/common)

response: {"access_token":"token value encrypted"}

Retrieves specific user data using email

Request

GET [Organization URI]/api/data/v8.2/systemusers?$filter=contains(internalemailaddress,'davids@crmdemo.dynamics.com') HTTP/1.1
Authorization: "Bearer <access_token>"
Accept: application/json
Content-Type: application/json; charset=utf-8
OData-MaxVersion: 4.0
OData-Version: 4.0

Response

{
  "@odata.context":"https://testdynamics3650.crm8.dynamics.com/api/data/v8.2/$metadata#systemusers/$entity","@odata.etag":"W/\"987803\"","systemuserid":"9025bbf4-3430-4d0c-bfcf-16f0bf7fbc80","accessmode":0,
  "firstname":"David","address2_shippingmethodcode":1,"issyncwithdirectory":false,"address1_addressid":"420fc494-f768-4e49-b50e-f16a5b4c2fbd","incomingemaildeliverymethod":2,
  "internalemailaddress":"davids@crmdemo.dynamics.com","domainname":"administration_5@crmdemo.dynamics.com","_queueid_value":"632476fd-32d9-e611-8119-c4346bdc3cc1",
  "isintegrationuser":false,"createdon":"2017-01-13T01:52:51Z","_calendarid_value":"01fbd78c-61f2-4ca3-bb46-245d82e7b086","windowsliveid":"administration_5@crmdemo.dynamics.com",
  "address1_addresstypecode":1,"_businessunitid_value":"85bf39cf-2bd9-e611-8119-c4346bdc3cc1","displayinserviceviews":false,
  "defaultodbfoldername":"CRM","caltype":0,"modifiedon":"2017-01-19T06:20:59Z","address1_shippingmethodcode":1,"defaultfilterspopulated":false,
  "outgoingemaildeliverymethod":2,"address1_composite":"US","emailrouteraccessapproval":2,"versionnumber":987803,"address2_addresstypecode":1,
  "preferredphonecode":1,"fullname":"David So (Sample Data)","setupuser":false,"preferredemailcode":1,"userlicensetype":3,
  "_modifiedby_value":"60ebc0f7-6bb0-49fa-9156-6c14b0eff61d","organizationid":"29f9e343-0e12-4d21-a7ec-455afe88b257","lastname":"So (Sample Data)",
  "isemailaddressapprovedbyo365admin":false,"invitestatuscode":0,"yomifullname":"David So (Sample Data)","isdisabled":true,
  "address2_addressid":"40284624-7726-4be5-83dc-55e7bb0317ea","_defaultmailbox_value":"622476fd-32d9-e611-8119-c4346bdc3cc1",
  "address1_country":"US","preferredaddresscode":1,"islicensed":true,"ownerid":"9025bbf4-3430-4d0c-bfcf-16f0bf7fbc80","_createdby_value":null,
  "nickname":null,"azureactivedirectoryobjectid":null,"address2_stateorprovince":null,"applicationiduri":null,"address1_county":null,
  "address2_country":null,"address2_postofficebox":null,"yammeruserid":null,"title":null,"employeeid":null,"_territoryid_value":null,"jobtitle":null,
  "skills":null,"address2_composite":null,"address1_postalcode":null,"entityimage":null,"address1_line3":null,"disabledreason":null,
  "address2_utcoffset":null,"address1_line2":null,"address1_city":null,"personalemailaddress":null,"address1_telephone2":null,"_createdonbehalfby_value":null,
  "address1_longitude":null,"sharepointemailaddress":null,"yomifirstname":null,"exchangerate":null,"yomimiddlename":null,"address2_line2":null,
  "address1_line1":null,"address1_telephone1":null,"traversedpath":null,"yomilastname":null,"address2_latitude":null,"mobilephone":null,
  "address2_fax":null,"address1_latitude":null,"entityimage_timestamp":null,"photourl":null,"_siteid_value":null,
  "_transactioncurrencyid_value":null,"passportlo":null,"_mobileofflineprofileid_value":null,"address1_name":null,"address2_telephone2":null,
  "_parentsystemuserid_value":null,"stageid":null,"address2_longitude":null,"salutation":null,"yammeremailaddress":null,"address2_city":null,
  "middlename":null,"entityimageid":null,"address2_county":null,"address2_line1":null,"address2_upszone":null,"address1_utcoffset":null,
  "_positionid_value":null,"passporthi":null,"address1_telephone3":null,"address2_postalcode":null,"address2_telephone1":null,"entityimage_url":null,
  "processid":null,"governmentid":null,"_modifiedonbehalfby_value":null,"address2_line3":null,"utcconversiontimezonecode":null,
  "homephone":null,"address2_name":null,"overriddencreatedon":null,"address1_upszone":null,"importsequencenumber":null,"mobilealertemail":null,
  "address1_fax":null,"address2_telephone3":null,"address1_postofficebox":null,"address1_stateorprovince":null,"timezoneruleversionnumber":null,
  "applicationid":null
}

Process the json response

  1. After the API call returns the json response, process it
  2. Update the Learnexa User table with the relevant data retrived from the CRM

Integrating Ms Dynamics CRM to Learnexa

  1. Create a new page in Manage site as “Integrate Dynamics CRM” with a form to enter CRM organisation URI, azure tenant ID, client ID provided in the Azure AD
  2. Once the form is submitted invoke a Delayed Job to update all the user records in Learnexa User Table by getting details from CRM
  3. On timely(every week/month) bases we can invoke the job again and again to update the user details that are changed in the CRM

Database

Create a new table to store MS dynamics CRM details:

dynamics_crm_settings

IDinteger
company_idinteger
organization_uristring
tenant_idstring
client_idstring

users

created_sourcestring

References

microsoft_dynamics_crm_integration.txt · Last modified: 2018/08/31 16:16 (external edit)