Tuesday, 26 November 2019

How to Update Addresses Details for Contact\Account while Importing those records using Native Tool

                                                   

Hi All,

I would like to provide small Info regarding How to Update Address Records using Native Tool in CRM Online.

If you are using Native Tool to Import Accounts\Contacts Records into Engage along with Addresses details of respective Accounts \Contacts, Records will get successfully imported to Engage without any issues ., but Address Info will not show in Address Sub-Grid cause Mail Type and Address Number are not updated while Importing Accounts\Contacts as shown below.













As per CRM Configurations , Address Number , Address Type and Mail Type has to be provided for Address Records in order to update Address Relationships with specific Records like Account\Contact. Hence , below is the option which you can use if you are Importing Accounts\Contacts Records using Native Tool.

  1. Import Account\Contact using Native along with Addresses details
  2. Using Advanced Find  , try to retrieve related Addresses for either Accounts\Contacts as shown below :


                                                                       


  1. Retrieve associated Accounts\Contacts Addresses and download the excel sheet with all the required information.
  2. Create columns i.e. Mail Type , Address Number and Address Type in Excel and update the values for the same as per your requirement. Refer Screenshot below for Example.


  1. Reimport Address Records so that existing records will get updated with mentioned info and associated Addresses records will be displayed in Addresses Sub-grid.

Note :
  1. Once after exporting the static excel data sheet – Do not remove columns ( A, B , C) as A holds Primary Key Info and during Import Operation – CRM will perform Primary Key check to verify if record already exists. If record already exists , record will just updated instead of creating new record.

Screenshot for Primary Key Column which is hidden in sheet :




  1. Do Not use CSV file to Upload data to Engage. Use Excel file to update Address Records as CSV upload will try to create new records instead of updating existing ones. Excel will successfully update existing records as shown below:





Thanks for visiting the Blog. 

Monday, 30 September 2019

How to Identify Duplicate Records in SQL Server and MS CRM | Duplicate Detection Jobs in CRM


HI All,

I would like to share some information regarding Identifying Duplicate Records in SQL Server while Migrating data to CRM and Process to Identify\Remove Duplicate Records from CRM using OOB Configurations. I figure most of you might be aware , but as a revise providing you below info.

  1. Identify Number of Duplicate Rows in SQL Server based on selected columns

        Sample Query :
                      
SELECT     ContactId,     [Name],     COUNT(*) occurrences
FROM [Lipscomb_Prod_Migration].[dbo].[Previous_Education_Radius_Produ$]
GROUP BY
               ContactId, [Name]
HAVING     COUNT(*) > 1;

  1. Delete Duplicate Rows in Staging SQL Syntax :

Sample Query :
WITH cte AS (
    SELECT
       ContactId,
 [Name] ,       
        ROW_NUMBER() OVER (
            PARTITION BY
                ContactId, [Name]
               
            ORDER BY
               ContactId, [Name]
        ) row_num
     FROM
        [Lipscomb_Prod_Migration].[dbo].[Previous_Education_Radius_Produ$]
)
DELETE FROM cte
WHERE row_num > 1;



  1. Duplication Detection of Records in CRM :
  • Navigate to Settings > Data Management > Duplicate Detection Jobs
  • Create a New Duplicate Detection Job and select Entity which you want to find duplicate records
  • Run the Detection Job so that below pop-up window will display :


Where we can take necessary action on the record.

Monday, 13 May 2019

Configuration Migration Tool

In order to Export\Import Data from any D365 Org to another D 365 org – Microsoft has provided us with Configuration Tool which is available via CRM SDK. The purpose of the tool, pros \ cons and differences with other tools are mentioned in this document below.

Purpose:
The Configuration Migration tool enables you to move configuration data across Dynamics 365 for Customer Engagement instances and organizations. Configuration data is used to define custom functionality in Customer Engagement apps and is typically stored in custom entities. It has ability to transport Data along with configurations so that Date Time values, Drop downs , Lookups will be imported to other org without any issues.

Flow :


Steps :

1.       Download CRM SDK Tools folder from NuGet
2.       Open Tools folder and click on Data Migration Utility as shown below :




3.       Click on DataMigrationUtillity to open Tool
4.       Tool will open as below ( Click on Create Schema which we will be using later to export data from CRM )




5.       Provide Login details to select the org from where you need to export data as shown below :




6.       Select respective Solution and entity and select Columns which you need to export as shown below :



7.       After selecting Entity and fields – click on Save & Export

8.       Once after clicking on Save & Export – the below screen will pop-up where we need to provide data file location so that the configurations will be saved as Zip file in local machine.



9.       After few minutes , all the records will be exported as Zip file along with Configurations.
10.    Once the export is complete – all the steps should show Tick Mark as shown below to confirm completion of Export


11.   Download the zip file and in the same way, you can Import this data to multiple Organizations without any issues.
12.   In above screenshot, the export time is showing as 5 hours , cause there were many interruptions in middle like Locking system.
13.   If any Errors in Data Export\Import – Check c:\Users\<UserName>\AppData\Roaming\Microsoft\DataMigrationUtility\<Version>. For Error logs.




Pros of Config Tool :

1.       Allows Migration of data from one CRM Org to another Org without any additional configurations \ Logging to multiple orgs
2.       Can handle 50,000 + records in an easy and effective manner
3.       Will export configurations as well along with data – so that Data Quality can be maintained and will take care of any issues with data.
4.       All the metadata values will be exact in comparison to the Org from where data was exported.
5.       All the Guids for records will remain same when importing it in other org so that if any customizations done on Guids will work as usual.
6.       Microsoft provided tool – hence support provided by Microsoft if any customers use this tool
7.       Ability to resume data export \ import when any disturbances during this process
8.       Any failures in Export \ Import – will be shown in Tool logs \ CRM System Jobs

Cons :
1.       Scheduled Import \Export not available
2.       Export\Import can be done only for one Entity at a time

Differentiation \ Conclusion:
When using Native Export\Import or XrmTool Box or Config Migration Tool – I haven’t found much differences, expect metadata validations in Configuration Migration tool. In order to assure data quality during Export and Import – configuration tool is preferred, but for small data exports\Imports – Native Export\Import will work better.  

Monday, 15 April 2019



Hi guys , 

I would like to provide brief details regarding how to Implement Plugin in MS CRM which is Beginner and Intermediate level. 

MS CRM Version : 9.0 ( Online) 

Topics Highlighted are :

  1. How to get Dll from Nuget
  2. How to get Plugin Registration Tool and Configuration Migration tool
  3. Sample Plugin code
  4. Difference between Isolation Mode None vs Isolation

Article : 


How to write a Plugin

1.       Go to this website and copy the script :

2.       Copy the Script mentioned in website as shown below :




3.       Open Windows PowerShell in Windows machine and run the script which we got from above

4.       It will download Tools folder from this link which contains Sdk dlls and Plugin Registration tool.



 Note : SDK dlls can be downloaded from Nuget package manager as well , but Plugin Registration Tool and Configuration Manager Tool is available  only via  running Powershell Script as mentioned in step 1.

5.       SDK Dll version compatibility – Microsoft recommends sdk dll version and CRM version should match. For example – if my org is on version (8.2) SDK dll should be on version ( 8+). This is cause there are few Architectural changes in different CRM versions. Hence few functionalities will not be compatible if we use old dlls.

6.       Open Visual Studio and select Class Library ( .Net Framework) to create a new plugin assembly

7.       Include Refence dll i.e. like Microsoft.xrm.sdk.dll in your class library project as shown below







8.       Sample CRM Plugin code :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Crm.Sdk;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Tooling;

namespace Plugin_Library
{
    public class UpdatePluginTest : IPlugin
    {
        public void Execute(IServiceProvider serviceProvider)
        {
            // Get Plugin Execution Context

            IPluginExecutionContext executionContext = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

            // Get Organization Service from Organization Service Factory

            IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));

            IOrganizationService service = serviceFactory.CreateOrganizationService(executionContext.UserId);

            if(executionContext.InputParameters!=null)
            {

                try
                {
                    // For creation of Record

                    Entity entity = new Entity("Account");

                    entity["name"] = "JK Test";

                    service.Create(entity);
                }
                catch(Exception e)
                {
                    throw new Exception(" Error in creation of record. Error Message is " + e);
                }

                // For update of Record

                try
                {

                    Entity entity = new Entity("Account");

                    EntityReference entityReference = (EntityReference)entity.Attributes["name"];

                    Entity parentEntity = new Entity("Account");

                    parentEntity.Id = entityReference.Id;

                    parentEntity["name"] = " JK";


                    service.Update(parentEntity);
                }
                catch(Exception e)
                {
                    throw new Exception(" Error in update operation and the error message is" + e);
                }

            }

            throw new NotImplementedException();
        }
    }
}

Here Iplugin is the Interface which is present in SDK base class and it contains Execute method which is the opening point for execution to start.

Ø  IPlugin Execution Context brings in Plugin details like execution pipeline , message on which plugin triggers , user context , assembly location.
Ø  IOrganizationServiceFactory brings in all data\component information in the org in order to perform operations on the data.

Ø  Once the plugin is built – Build The Solution to acquire dll which will be generated in location as shown below ( Sample ) :

C:\Users\jayakrishnak\source\repos\Plugin Library\Plugin Library\bin\Debug\Plugin Library.dll 


Ø  Open Plugin Registration tool in Tools folder as shown below :





Once you have the dll – open the Plugin Registration Tool from Tools folder and connect to Office 365 Online Instance ( Sample Picture below)




In the above picture – Select Show Advanced  will open up Regional Data centre details so that we can specify Data Centre location if known which reduces execution time and increases performance .

Ref Picture : 


Ø  Now Register the Assembly using Register New Assembly option as shown below ( select the dll which you have generated via visual studio to create new plugin assembly)







Once you add Assembly – go to Step 3 to specify Isolation mode. For Online Instances \Orgs – Isolation mode has to be Sandbox cause Sandbox execution is more secured and external references will be included only if it is secured.

Isolation Mode :

Sandbox  : If you specify your plugin to run in isolation mode – Sandbox – it allows more secured transactions and below actions cant be performed in Sandbox mode –

  • Access to the file system (C Drive)
  • system event log
  • certain network protocols
  • registry
  • You cannot access any other DLL’s
  • You cannot call any webservices from within a sandboxed plugin
  • IP addresses cannot be used
  •  Only the HTTP and HTTPS protocols are allowed.

None : In none mode – Security is less for transactions and you can include your local machine documents , images and even you can access other websites in None mode. 

  • In isolated mode you cannot call any external DLL’s\DLL’s in the GAC

Now navigating to Step 4 – Specify Location to store Plugin Assembly



Database – Plugin Assembly will be stored in Database and this option allows to transport plugin assemblies via solutions to different Orgs.
Disk – Plugin Assembly will be stored in local disk reducing efforts on database and transactions will be faster. But limitation is that Plugin Assembly can’t be exported to other orgs via Solution Export\Import

GAC – We can store assembly in a Global Assembly Cache so that all the Assemblies can be well Organized. But plugin assemblies can’t be exported using Solution.

Register the Assembly and Register New step to define when the plugin should Trigger and on behalf of which user it should trigger and specify whether Synchronous \ Asynchronous.
 I will discuss Plugin Execution Pipeline over next mail.