Get Excel Report or Create Database table Directly from FetchXML file

What is Issue?

The creating report or database table using complex fetchXML and getting records more than 5000.

The Reason-

It is difficult to get data directly from MS CRM without any coding or using third party tool .


Here is the new tool created by mscrm16tech which allows you to save data in excel sheet from MS CRM or helps you to create Database table with the display names available in MS CRM. These reports and data dump minimizes the developer efforts.

When you install and open the application in your system you will get below window which will help you in configuration of MS CRM connection and database connection if needed.


After configuring the app and clicks on OK, you will get below window –


Please follow the images to work with the app.

You can download app Here- FetchApp by MSCRM16Tech

Hope this will help…
Enjoy Ms CRM!!!

Follow on Facebook- FB: MSCRM16Tech


Generate Early Bound Classes for selected entities using CrmSvcUtil.exe in MS CRM v9.x

What is Issue?

There is CrmSvcUtil.exe to generate early bound entity classes. But this utility generates the classes for all the entities in the organization. But these entities are not required all the time. So how to generate classes for selected entities.

The Reason-

The Microsoft provided the CrmSvcUtil.exe utility in Microsoft.crmsdk.coretools which is used to generate early bound classes for entities, but there is no option to select particular entity or entities.


CrmSvcUtil.exe is available in Microsoft.crmsdk.coretools package and you can download this package from nuget.

The simple solution is provided by Erik Pool for Ms CRM 2011 and this will work D365 CRM v9.x as well. Just follow the below –

Create a new C# class library project in Visual Studio called SvcUtilFilter.

Add the below assemblies to your class Library-


Important reference is – CrmSvcUtil.exe
– This exe has interface ICodeWriterFilterService which needs to be implemented.
– Microsoft.Xrm.Sdk is mandatory
– Microsoft.Xrm.Tooling.Connector is important in case of v9.x.
– If you want to connect to your organization by interactive UI add
Microsoft.Xrm.Tooling.Ui.Styles and Microsoft.Xrm.Tooling.CrmConnectControl.

Add the following class to the project:

using System;
using System.Collections.Generic;
using System.Xml.Linq;
using Microsoft.Crm.Services.Utility;
using Microsoft.Xrm.Sdk.Metadata;

namespace SvcUtilFilter
/// CodeWriterFilter for CrmSvcUtil that reads list of entities from an xml file to
/// determine whether or not the entity class should be generated.
public class CodeWriterFilter : ICodeWriterFilterService
//list of entity names to generate classes for.
private HashSet _validEntities = new HashSet();

//reference to the default service.
private ICodeWriterFilterService _defaultService = null;

/// constructor
public CodeWriterFilter(ICodeWriterFilterService defaultService)
this._defaultService = defaultService;

/// loads the entity filter data from the filter.xml file
private void LoadFilterData()
XElement xml = XElement.Load("filter.xml");
XElement entitiesElement = xml.Element("entities");
foreach (XElement entityElement in entitiesElement.Elements("entity"))

/// /Use filter entity list to determine if the entity class should be generated.
public bool GenerateEntity(EntityMetadata entityMetadata, IServiceProvider services)
return (_validEntities.Contains(entityMetadata.LogicalName.ToLowerInvariant()));

//All other methods just use default implementation:

public bool GenerateAttribute(AttributeMetadata attributeMetadata, IServiceProvider services)
return _defaultService.GenerateAttribute(attributeMetadata, services);

public bool GenerateOption(OptionMetadata optionMetadata, IServiceProvider services)
return _defaultService.GenerateOption(optionMetadata, services);

public bool GenerateOptionSet(OptionSetMetadataBase optionSetMetadata, IServiceProvider services)
return _defaultService.GenerateOptionSet(optionSetMetadata, services);

public bool GenerateRelationship(RelationshipMetadataBase relationshipMetadata, EntityMetadata otherEntityMetadata, IServiceProvider services)
return _defaultService.GenerateRelationship(relationshipMetadata, otherEntityMetadata, services);

public bool GenerateServiceContext(IServiceProvider services)
return _defaultService.GenerateServiceContext(services);

Build the project.

Next step to create XML which specifies the entities names for which you want to have early bound class.

Create filter.xml file with below structure-







To add entity same way in this XML to create early bound class for it.

Add this filter.xml in same build folder debug/bin i.e. where the CrmSvcUtil.exe and all the other references located.

Now your build folder should be look like this-


Your tool is ready now.

How to run this?
Open Command prompt. Change directory to the bin folder and run below command-

crmsvcutil.exe /url:http://your_org_url/XrmServices/2011/Organization.svc /out:output.cs /namespace: /il /codewriterfilter:SvcUtilFilter.CodeWriterFilter,SvcUtilFilter

(For more information about parameters execute command : crmsvcutil.exe ? )

This will open the UI to connect Organization-


Connect to your Organization and then wait till your output.cs is ready.

You will be able to find output.cs file in same bin folder once command executed successfully. This file will be having early bound entity classes for your selected entities.

Hope this will help…

Enjoy Ms CRM!!!

Follow on Facebook- FB: MSCRM16Tech


Color Picker in MS CRM ?

What is Issue?

How to add Color Picker in MS CRM?
There might be situations where you have to use colors in MS CRM and you wish to have wide range of colors. But in MS CRM there is no field or option available for now.

The Reason-

You have multiple custom controls available in MS CRM right now but there is no option for color picker and there is no way to add your own custom control for now.There is no out-of-box Color picker available in MS CRM.


There are 2 solution for the color pickers –

  1. You can use Option set and provide user to select limited options of colors.
  2. You can use Custom web resource with your own libraries or open-source libraries.

The first option is reliable, but not much attractive if user wants some colorful UI and wide range of colors.

Using second option is not supported way but it gives you attractive interfaces.

There is open-source library available for color Picker – spectrum

You can use this library with dynamics CRM as web resources. You can have very nice color picker in MS CRM with these libraries.



Hope this will help…

Enjoy Ms CRM!!!

Change behaviour of + Button on subgrid(Add new/Add existing)

What is the Issue?

When you click on + Button on subgrid ,sometimes it opens new record and sometimes behaves like add existing by opening search box for existing records.

The Reason –

This behaviour of + button depends on the association between the entities. Adding new record will strictly associates records and add existing will allow you to associate records if required.


To change the behaviour of the + button you need to change requirement level of the lookup field of the entity on which you have subgrid i.e. parent entity.

For example- you have 2 entities – AEntity and BEntity.

AEntity contains subgrid of BEntity.

On BEntity form we have lookup field- AEntityLookup

Now behaviour will be decided on requirement level of AEntityLookup field.

1. If requirement level : Business Required

Then it will behave as Add new record of BEntity.

This will also change behaviour of record level delete button as record delete.

2. If requirement level : optional/business recommended

Then it will behave as Add Existing record of BEntity.

This will also change behaviour of record level delete button as record remove.

Try it..

Happy coding…!!!

Xrm Object Model v9.0 and greater

What is the Issue?

As of February 2017, the SDK extensions for Microsoft Dynamics 365 is deprecated, and won’t be supported in future releases of Dynamics 365, version 9.0 and beyond.

The Reason-

These extensions were added in Dynamics CRM 2013 to provide a simplified connection class, strong type generation for solutions, and web portal capabilities. These have been replaced with newer capabilities.


The Xrm client APIs are deprecated in the current release to reorganize the Xrm client API object model to better align with the need of using the same client scripts without having to change them based on the context or the client (web client or the new Unified Interface) where they run. You should plan to use the new client APIs mentioned in the Replacement Client API column instead of the deprecated ones.

Following is the comparison for old Xrm Object Model and new one.-

Old Xrm Object model-


This Old Xrm Object Model is replaced with the below one-


The Important change is Xrm.Page.Context is replaced with formContext i.e. executionContext.getFormContext.

Let’s see the example for new Xrm –


For the information about environment we were using Xrm.Page.Context which is now replaced with Xrm.Utility.getGlobalContext.

We have 4 new namespaces for new Client APIs-
1. Xrm.Device
2. Xrm.Encoding
3. Xrm.Navigation
4. Xrm.WebApi

Also for your information below are some of the deprecated Client APIs with their replacements-


Enjoy Ms CRM!!!