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.







Wednesday, 8 November 2017

Solution Import Issues 

When we are trying to import large customization files into CRM , the issues I encountered are :

1. Timeout Exceeded
2. MaxRequest Length Exceeded

The Error message we recieve is mentioned below :

System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.Crm.Setup.DatabaseInstaller.DatabaseUtility.ExecuteSql(InstallDatabase database, String sql, Int32 timeout) at Microsoft.Crm.Setup.DatabaseInstaller.SqlScriptAction.Execute() at Microsoft.Crm.Setup.DatabaseInstaller.DatabaseInstaller.Install(Int32 languageCode, String file, Boolean upgrade) at Microsoft.Crm.Setup.Server.InstallDatabaseAction.Do(IDictionary parameters) at Microsoft.Crm.Setup.Common.Action.ExecuteAction(Action action, IDictionary parameters, Boolean undo) --- End of inner exception stack trace --- at Microsoft.Crm.Setup.Common.Action.ExecuteAction(Action action, IDictionary parameters, Boolean undo) at Microsoft.Crm.Setup.Common.Installer.Install(IDictionary stateSaver) at Microsoft.Crm.Setup.Server.DatabaseInstaller.Install(IDictionary stateSaver) at Microsoft.Crm.Setup.Common.ComposedInstaller.InternalInstall(IDictionary stateSaver) at Microsoft.Crm.Setup.Common.ComposedInstaller.Install(IDictionary stateSaver) at Microsoft.Crm.Setup.Server.ServerSetup.Upgrade(IDictionary data) at Microsoft.Crm.Setup.Server.ServerSetup.Run()


If it is regarding to Http Timeout , perform below operations : 

1. open IIS Manager ( Internet Information Services) 
2. Navigate to Sites > Microsoft Dynamics CRM
3. Right click and open Web.config
4. Find the line : <httpRuntime executionTimeout="300" maxRequestLength="8192"/>

The max exceutionTimeout we can provide is "3600" and the maxrequestLength - "20000"


5. After modifying above mentioned values according to need , perform IIS Reset and try import\export operation again.


Note : Please revert back the changes after the required operation is completed as it will effect performance of the org

2. As Microsoft ASP.Net limits HTTP Requests to 8MB , if the solution size exceeds 8MB it will limit the operations

OLEDB Setting : Command Timeout ( Reg Key settings ) :

1.Locate HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM
2. Create new DWord Value , edit value to 86400 

Max value setting : 2,147,483,647

Friday, 10 March 2017

Data Import Issues and It's resolution points


  Hi friends , I am back here to present you the solutions for Data Import Issues we usually face in Microsoft Dynamics CRM application.Hope it will help you while working with the application.


Data Import:

Out of Box Data Import feature allows us to upload data from various customer relationship management systems and data sources (like Excel, Xml...) into Microsoft Dynamics 365. Data will be imported into standard and customized attributes of most business and custom entities .Notes and Attachments can also be included in data import.
    

Data Import Issues:


                While importing the Excel and Xml data into CRM, by following the Microsoft suggested guidelines most of the errors can be avoided. But in some scenarios the following issues may occur during data import.
The Issues which we may face during Data Import are:
1.    Update Field/Attribute Issues
2.     Insert Value to Attribute Issues
3.     Duplication of Records Issues


1.     Update Field/Attribute Issues:
                                                        While importing data into Microsoft Dynamics CRM using Data Import wizard, Attributes/Fields data is not updated in the CRM instead a new record will be created which will lead to duplication. A couple of approaches are provided below to resolve this issue and to successfully update the attribute.
                Updating records in Microsoft Dynamics CRM can be done using following functions:
  1.   UpdateExisting records by Export to Excel
  2.   Using Export to Excel Online feature


2.     Insert Value to Attribute Issues:

 The list of records which are not exported from CRM, but if we want them to update to CRM or add those records as newly created records in CRM, the below approaches are suggested.   We can add new rows in excel with the details mentioned in respective columns. Refer Solution1 for the same.

3.     Duplication of Records Issues:

When we are trying to import the records into the Dynamics CRM with the records or data which already exists in CRM, then it may lead to duplication of records. The below are the suggested approaches to avoid this duplication of records.

1.     Select ‘No’ Radio button for Allow Duplicates option in the Import Data wizard.

 Approach:

Steps to Select No Option:

1.     Open Import Data wizard in Entity Records Page and click on Import Data option.



2.     Open Import Data wizard, and click on browse option to upload the file which need to be uploaded.


3.     Select No Radio button in the Allow Duplicates option in order to not allow duplicates importing into the CRM.

                            
รจ Click on No radio button in order to not allow duplicates.

4.     Click on submit to proceed further and import data into CRM without any duplicate data inserted into CRM.

Hope this article helps you in successfully importing data into the Dynamics 365 without any duplication of records.

Hence, data can be uploaded into Dynamics 365 without any issues by following the approaches mentioned above for all the possible issues which may occur for Importing Data using Data Import wizard. 

Wednesday, 1 March 2017

Work Flow Monitoring 


            What is a Workflow    
                                        
Microsoft Dynamics 365 Workflows consists of a series of steps and rules that serve to automate a business process.It can run on an out-of -box entity or a custom entity.  It can be initiated manually, or they can be initiated automatically, in a number of different ways.


Issues with Workflows

If the workflow grows in size and complexity, organizing them will become very important. Stages will play a great role in organizing workflows, as they break down a number of tasks into smaller sections, and allow for task grouping. Workflows runs through only one stage at a time as it will reduce the performance stress and unresponsiveness created by large workflows

Workflow monitoring helps in managing tasks and requests, to build enterprise web apps, adding stability to your operation, End-to-end management of enterprise content and in creating real-time audit reports.

Infinite Loops:

A poorly designed workflow can result in an infinite loop (one of the known issues with Recursive or Scheduled Workflows) where the workflow runs indefinitely, using up available system resources like memory and disk space. But Microsoft Dynamics 365 has run-time logic to find and stop workflows that have entered an infinite loop. The system automatically stops the workflow. The maximum depth for a recurrence/loop is 8; however, the depth is reset after 10 minutes of inactivity.






Every time a running plug-in or Workflow issues a message request to the Web services that triggers another plug-in or Workflow to execute, the Depth property of the execution context is increased. If the depth property increments to 8, then it will enter into infinite loop. The depth can be configurable by the Microsoft Dynamics CRM administrator.

Issues \ Best practices for workflows


Please go through below links for finding the solutions to the below mentioned issues.



Hope this articles help you in better understating and resolving the issue with workflows.

Why do some Dynamics 365 users experience performance issues while others continue working normally?

This was one of the most interesting production issues I investigated. The original post was accidentally removed, so I'm bringing it ba...