Dynamics CRM 2016 – New Key press Events

The new key press event allows all developers to trigger a function when the user presses keys in a number or text control.  This will allow developers to provide more rich data validation in a supported manner which is especially useful if auto-save is used in organizations.

Example, if We want to ensure the user enters valid data into the native phone number field, we can register on the key press event and automatically remove invalid characters as the user presses them.

First we will setup a function on the new addOnKeyPress event for the main telephone field.

Xrm.Page.getControl(‘telephone1’).addOnKeyPress(function() { }); 

Then we will retrieve the value from the main telephone field to get the keys that the user inputted.

var userInput = Xrm.Page.getControl(‘telephone1’).getValue(); 

Then we will build a regex to replace any of the inputted keys that are not “(“, “)”, “-“, or a number.

userInput = userInput.replace(/[^\d-()]+/g, ”);

Lastly, we will replace the main telephone value with the new clean version of the user’s input


Now if a user presses an invalid character in the main telephone field, it will automatically delete the character so the field will not be saved with invalid data.


How to add the DLL to the GAC where no GACUtil found on Server?


Recently I tried to update the third party DLL in the GAC. but when I open my server I did not find the GACUTIL on my server. When I tried for the solution this BLOG helped me.


Hope this helps! 🙂

Create early bound entity classes by using CrmSvcUtil.exe

We need to run the CrmSvcUtil.exe tool from the SDK\Bin folder.

Note: If we are run the tool from another folder location, we have to make sure that a copy of the Microsoft.Xrm.Sdk.dll assembly is in that same folder.

Please find the syntax

CrmSvcUtil.exe /url:http://<serverName>/<organizationName>/XRMServices/2011/Organization.svc   
/out:<outputFilename>.cs /username:<username> /password:<password> /domain:<domainName>   
/namespace:<outputNamespace> /serviceContextName:<serviceContextName>


Hope this Helps! 🙂

Working with a Plug-In whcih is using third party DLL reference in it


One more working experience I want to share about the plug-In.

I wrote a plugin in which I used another Class DLL (Third party). Now build the plugin project and registered the Plugin DLL on my CRM server with the help of registration tool.

Now I did browse the CRM Organization and perform the required operation so that the plug-in code will get executed. Now I got the error by saying that the third party DLL which I used was not found / loaded.

To fix this issue I kept the other DLL in the CRM server GAC By using the GACUTIL registration command in the command prompt.

1) Open the command prompt and navigate to gacutil folder path.

2) execute the below statement to place the DLL in the GAC.

gacutil.exe /i c:\TestApplication.dll

Now once after this my application started working fine.

Hope this Helps! 🙂

Debug a Plug-in in CRM 2011 Environment


Today I would like to share my practical experience which I came across while working with Plug-In in our environment.

I what to explain about two things here

  • Debug a Plug-In online using Remote Debug method
  • Debug a Plug-In using Profile and Debug Options in Registration Tool

Debug a Plug-In online using Remote Debug method:

1) Make sure you have Remote Debugger tool installed on your CRM 2011 Server. If you do not find the remote debugger tool then please down load and install the “rtools_setup_x64.exe

2) Once the Installation is done then you can see the Remote Debugger Service Installed on the server with disabled Mode.

Remote Debugger Service

3)  Enable and Start the Service with Manual Start Up Type (this is optional. You can use Auto Start Up Option even for service Start Up).

4) Register the Latest Plug-In DLL By using Registration Tool or By Using CRM 2013 SDK Developer Tools (Dynamics CRM 2013 Package Solution Deploy method).

5) Browse the CRM Organization from your browser so that the W3WP.exe Process will be up and running on the CRM server.

6) Open the Plug-In Development environment (IDE) and Keep the Break Point in Plug-in Execution Method.

7) Once After this, Invoke the “Attach to Process” method which  you can Navigate through Debug Menu in the Development IDE.

8) Attach the W3WP.exe from the CRM server Processes.

9) Perform the required operation in CRM organization so that the Plug-In code will get executed.

10) Now you can see the stopping of the code execution at your breakpoint.


Debug a Plug-In using Profile and Debug Options in Registration Tool:

1) Open the Plug-In Development environment (IDE) and Keep the Break Point in Plug-in Execution Method. Build the Plug-In DLL.

2) Open the Plug-In Registration Tool

3) Register the Latest Plug-In DLL By using Registration Tool or By Using CRM 2013 SDK Developer Tools (Dynamics CRM 2013 Package Solution Deploy method).

4) Check whether the Profiler got installed or not by using the Plug-In registration tool?

5) If the Profiler was not installed then install the Profiled by using the Install Option in Plug-In registration tool.

6) Select the Specified Step in your Plugin Assembly and click on “Profile” button in Registration tool.

7) Browser the CRM Organization and perform required operation so that your Plug-in code will get executed.

8) You will get populated with an Error Message. Download the Error message and save that into a file.

Plug-In Profiler Error

9) Now come to the Plugin Registration tool back and Click on “Debug” button which you can see just beside the “Profiling” Button.

10) This will open a window (Debug Existing Plug-In) and asks for Profile path and Assembly path. Please provide the Downloaded error file path in the profile path and Plugin Assembly path in Assembly path.

11) Once after that Navigate to Plug-In Development environment (IDE) and Attach the “Plug-In Registration exe process” by using Debug–> Attach to Processes.

12) Now Open the Debug Existing Plug-In window and click on “Start Plug-In Execution” button

Plug-In Execution

13 ) Now you can see the stopping of the code execution at your breakpoint.

Hope this Helps!:)

CRM Developer Toolkit for Visual Studio 2013


The toolkit release by Microsoft “CrmDeveloperToolsVS12_Installer.msi” is not working on the machine where I have VS 2013 installed on Windows 8.1.

We are getting error message when I tried to install the file.


But after that I tried to install the same on Windows 7 Enterprises 6.1 with VS 2012 Premium Version 11.0.50727.1. Everything went fine. I am able to get the Dynamics CRM node in my New Project window.

Hope this helps!:)

Difference between Find and Advanced Find in CRM 2011 Or 2013


Today we will see the basic difference between Quick find and Advance find.

  • Find perform a search on an attribute for which it is defined.
  • Advanced Find perform search on the conditions and the attributes for which user customizes or runs it.


  • Normal Find in faster as it looks for one attributes and matches with that and returns the result whereas Advanced Find searches for all the attributes and conditions while parsing through the records. Find is applicable on only active records and it finds only on 2 or 3 column which we have defined in the find view and even it returns any those column which is there in the view but advanced find is applicable to all the records and it finds all the columns and even it returns all the column and filter criteria can be on any column and most important – find filters on just one condition but advanced find filters on multiple condition at one time..


  • Finally the Find is faster than Advanced Find.

Hope this helps!:)

Max Number of controls got allowed in CRM 2011 / 2013 Dashboards


Today we will know simple but important thing.

By default Dynamics CRM allows users to place max 6 widgets (controls / Views / Charts/ Lists) in the dashboards. But there is a possibility to extend the count to more. But that can’t be performed by using simple out of the box settings.

We can extend the count to more by using the PowerShell script.

Open the Windows Power Shell on CRM Server

Add the Microsoft Dynamics CRM PowerShell snap-in using below command

Add-PSSnapin Microsoft.Crm.PowerShell

You may get the message saying something like “Add-PSSnapin : Cannot add Windows PowerShell snap-in Microsoft.Crm.PowerShell because it is already added.”  no problem,  you can continue.

Run the following 3 commands

$setting = Get-CrmSetting -SettingType DashboardSettings
$setting.MaximumControlsLimit = 9 (// you can change this number)
Set-CrmSetting -Setting $setting

Hope this helps!:)

CRM 2011 Plug-In Assembly deployment storage Options


Today we will see the CRM Plug-In Assembly Deployment storage Options.

The 3 storage options are available to deploy a plug-in:
1) Database
2) Disk and
3) GAC

The main differences between these are:

Database: The assembly dll is stored in the database, rather than the file system. The major advantages are that the assembly need only be deployed once if you have multiple CRM servers, and that no additional action is required to restore / redeploy the assembly either during disaster recovery, or if redeploying to an alternate server. This is the preferred option in a production environment

Disk: The assembly dll is placed in the \server\bin\assembly directory on each server. You have to ensure the dll is placed in the correct place on all CRM servers, so the deployment overhead is a little greater. I normally use this option in development environments as you can redeploy newer versions solely by file transfer, rather than reregistering. Also, if debugging, the assembly .pdb file needs to be placed in the same location; with this option it’s easy to ensure the dll and pdb are from the same build.

GAC: The assembly is placed in the Global Assembly Cache on each CRM server, and again you will have to do this. The GAC does allow multiple versions of an assembly, but CRM doesn’t, so you don’t really gain anything by using the GAC. We never used this option.

Note: There is one further consideration. If your plugin assembly has other dependent assemblies, then you can place this dependent assembly in the GAC whichever of the above options you take. However, if you use the Disk option, then the dependent assemblies can also be deployed into the \server\bin\assembly directory

Hope this helps!:)