List of solution components that can be deactivated in Dynamics 365 (or CRM 2016)

Recently while working on one of the requirements, I had to prepare list of solution components that can be deactivated.

Below is the table that I had prepared for quick reference

Solution Component Can be deactivated?
Form Yes
View Yes
Business Rule Yes
Process Yes
Connection Role Yes
Routing Rule Set Yes
Record Creation and Update Rule Yes
Entity No
Chart No
Field No
Key No
Relationship No
Option Set No
Application Ribbon No
Site Map No
Web Resource No
Dashboard No
Report No
Templates No
Security Roles No
Field Security Profile No

Hope it helps..

Parallel.For vs ExecuteMultiple in Dynamics 365


Thought of getting a rough idea on how much performance improvement we can gain if we are using Parallel.For and ExecuteMultiple.

Took a very simple scenario i.e. creating 10000 account records.

Normal For Loop 3242061 milliseconds à 54 minutes à 185 records per minute
Parallel.For 2160337 milliseconds à 36 minutes à 277 records per minute
ExecuteMultiple (single request with batch size of 1000) 494663 milliseconds à 8 minutes à 1250 records per minute

This clearly tells ExecuteMultiple far better.

The sample code that I used for Parallel.For

Hope it helps..

Resources in Use -300 Custom Entities Limit in Dynamics 365 (online)


Till CRM 2015 update 1, we had upper limit of 200 Workflows, 300 Dialogues and 300 Custom Entities. From CRM 2015 Update 1 onwards, the limit of workfows, dialogues and custom entities have been removed.

In Dynamics 365 Online we can still see information related to custom entities which shows upper limit as 300. However this is more of indicative and there is no upper limit now. Please refer the below link for more details

Go to Settings –> Administration –> Resources in Use


Hope it helps..

Cleared MB2-712 Microsoft Dynamics CRM 2016 Customization and Configuration


Today i cleared MB2-712 certification exam. It had 48 Questions in it with passing score 0f 700.

I referred to the following guide for my preparation by CRM MVP Neil Parkhurskt

Hope it helps..

Sample code to connect to Dynamics 365 Online through Console App (C#)

  • Create a console application add Newtonsoft and Active Directory Authentication Library. Or we can add the below Helper Sample Code package which will add the above libraries.

  • Add reference to System.Net.Http

  • Register the app

  • Sample Code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace Dynamics365ConsoleApp
internal class Program
// username and password
private const string UserName = "";
private const string Password = "mypassword";
// Crm Url
private const string Resource = "";
// Application's Client Id
private const string ClientId = "d08b641c-2dc8-4f33-8a57-b1573da88a22";
// Redirct Uri specified during registration of application
private const string RedirectUri = "http://localhost";
// Authroiztion Endpoint
private const string Authority = "";

private static AuthenticationResult _authResult;

private static void Main(string[] args)
// without prompt
var authContext = new AuthenticationContext(Authority, false);
var credentials = new UserCredential(UserName, Password);
_authResult = authContext.AcquireToken(Resource, ClientId, credentials);

// with prompt
AuthenticationContext authContext = new AuthenticationContext(authority);
authResult = authContext.AcquireToken(resource, clientId, new Uri(redirectUri));

Task.WaitAll(Task.Run(async () => await GetFullNameSystemUsers()));

private static async Task GetFullNameSystemUsers()
var httpClient = new HttpClient
BaseAddress = new Uri(Resource),
Timeout = new TimeSpan(0, 2, 0)
httpClient.DefaultRequestHeaders.Add("OData-MaxVersion", "4.0");
httpClient.DefaultRequestHeaders.Add("OData-Version", "4.0");
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer",

var retrieveResponse =
await httpClient.GetAsync("api/data/v8.1/systemusers?$select=fullname");
if (retrieveResponse.IsSuccessStatusCode)
var jRetrieveResponse =

dynamic systemUserObject = JsonConvert.DeserializeObject(jRetrieveResponse.ToString());

foreach (var data in systemUserObject.value)

For in depth understanding please refer the following post

Hope it helps..

Register a Dynamics 365 app with Azure Active Directory

  • Sign in to Microsoft Azure Management Portal or Sign up for a free trial. The account should be in the same Office 365 tenant where we would like to register the app. (or link existing Azure Subscription not in same tenant as CRM)

  • Inside Azure Management Portal select Azure Active Directory

  • Select App registrations and click Add

  • Provide required details for the App and click Create

  • Select the App created to get the required details

  • To give permission to App to access Dynamics CRM, click on Required Permissions in API Access section

  • Click on Add

  • Select Dynamics CRM Online

We’d get the notifications.

  • Along with Client id we would also need Authorization Endpoint, when we develop App.

Hope it helps..

Crm Internal Exception: Singleton Retrieve Query should not return more than 1 record. Query: System.Data.SqlClient.SqlCommand while Importing Solution in Dynamics 365 \CRM 2016 or earlier.


While using “Apply Solution Upgrade” or Import in our Test Instance having managed solution, we got the below error.

The Managed solution had the report set as Viewable By = Organization (we cannot have Individual report in Solution) when it was deployed first. And later the user had set the report to be as Individual manually.

Changing the report back to Organization in TEST and importing the solution again fixed the issue.

Hope it helps..

Create Apps in Dynamics 365 using new App Designer and Site Map Designer in Dynamics 365

Similar to the apps that we see in Menu Bar for Dynamics 365, we can create our own apps.

First we need to enable the Preview for it.

Go to Administration à System Settings

Go to Settings à My Apps

Click on Create App

It will take us to App Designer, provide details.

Different components that we can add

Or drag drop

First we need to configure the SiteMap for the app. Click on arrow inside Sitemap area to configure.

Inside Site map designer we can add Area, Group and Sub Area (the usual components of Site Map)

Update properties of Area, Group and Subarea and add new Sub Areas.

Area Properties.

For Group

For SubArea

Different Types of Sub Area can be defined.

This is how the app looks inside Site Map Designer

Save and close to go back to App Designer

It has added Dashboard along with Contact and Lead Entity View.

Now let us add Form and Views to Contact and Lead Entity View using Entity assets.

Select Contact in Entity View and select Forms in Entity Assets

Similarly, for Views

Repeat the same steps for Lead entity.

Click on Validate

It will show up all the dependencies

Required tab will list all the dependencies. For time being let us add all the dependencies

Publish the app.

The apps would appear now in Dynamics 365 menu

We can specify specific roles which could access the apps.

Hope this helps ..

New Visual Designer for Business Rules in Dynamics 365

In Dynamics 365 we have new visual designer for Business Rules (and Business Process Flows).

Condition and Actions can be added through Add button or dragged and dropped

Conditions and Action can be copied, cut. delete and pasted in designer window.

Snapshot creates a snapshot of the business rules. (image file with png extension)

Conditions can be defined in the Properties window

Still we can only specify either Add or OR conditions

Changing it to OR replaces AND condition

May be in future release we’d have that feature as well.

Hope it helps..

Quick Walkthrough – Editable Grid in Dynamics 365.

Let us try exploring Editable Grid in Dynamics 365

We’d enable it on Contact Entity ( editable grid works for custom entities as well)

  • Go to Contact entity, control tab and click on Add Control

  • Add Editable Grid

  • Enable Editable Grid as default for Web, Phone and Tablet

  • Save and Publish the change.
  • Go to Contact Home Grid. (fields now can be edited, Status, Composite fields etc are not editable)

  • We can do Group By on the grid

  • Similarly, in Associated View of Contact we have the same behavior

  • To switch back to Read Only Grid, select SHOW AS command

  • Back to our old Read Only Grid (no grouping)

  • We can add JScript for fields inside grid.
  • Let us try Adding function on OnChange of Address 1: City field inside Editable Grid

  • On changing the City field in the grid

For Subgrid,



Hope it helps..

PowerApps in CRM 2016 (Microsoft Dynamics 365)

Let us quickly create a PowerApp that allows a user to create Contact record inside CRM (using Microsoft Flow).

  • Login to PowerApps with Office 365 Account

  • Click on New app

  • Let us use PowerApps studio for Windows here (much easier to use then PowerApps for web)

  • Select a Blank App (Phone Layout)

  • Insert Text Box, Text Box Input and Button controls and apply Theme

  • Select Add to CRM button and select Flow in Action menu to connect with the flow.

  • Create a new Flow

  • Search for PowerApps

  • Select Add an action

  • Select “Create new a record” Action and select Contacts in Entity Name.
  • For Last Name field, click on “Ask in PowerApps” which will add a new field to be mapped inside PowerApps

  • Do same for mobile phone field

  • Click on Create flow to create the flow

  • Now back in PowerApps, select the newly created flow.

  • Specify formula to map the fields

  • Run the application

  • Specify the values for Last Name and mobile number and click on Add to CRM button.

  • This creates the contact record in CRM using the Flow defined.

  • We can save the app in cloud and the share it with the other users inside the org.

  • Click on Share (Enter name or email addresses of the users with whom we’d like to share the app)

  • App being published

  • Once Published, it would be available to the other users.

Hope it helps..

Using Update to change the status and update owner (instead of SetState and Assign Request) in CRM 2015/2016

Prior to CRM 2015 Update 1, if we had to change the owner or set the state of the record we had to use Assign and SetState Request.

Now we can use our Update request for the same.

For e.g. we have below Active record owned by user named Nishant Rana.

Using below Update Request we can change the owner as well as set the record as inactive in a single request.

Entity demoEntity = new Entity("new_demoentity");

// here we are using alternate key to update the record instead of Guid
demoEntity.KeyAttributes.Add("new_alternatekeyfield", "My Alternate Key 2");

demoEntity.Attributes["new_name"] = "Updated record at " + DateTime.Now.ToShortTimeString();

// update owner id
demoEntity.Attributes["ownerid"] = new EntityReference("systemuser", new Guid("16406B31-5E97-E611-80E3-FC15B42877A8"));

// set record as inactive
demoEntity.Attributes["statecode"] = new OptionSetValue(1);



Point to remember is that if we have plugin registered either PRE or POST on Update and Assign both will be triggered.

Hope it helps..

Sample Code to use UpsertRequest in CRM 2015\2016

UpsertRequest was a new request introduced in CRM 2015 Online Update 1.

The request based on the alternate key specified, looks for the record, if the record is existing it updates it else it creates a new record.

UpsertResponse has a property named RecordCreated which is false if the record is found and updated else it is true if record is created. The Target property holds the reference of the record created or updated.

Suppose we have following record created. It has Alternate key defined on “Alternate Key Field”

Sample Code

As we have demo entity record with alternate key field having value as “My Alternate Key 1” it will update the record.

Running it again this time changing the value for the alternate key field.

It creates a new record.

Hope it helps..

Using PluginTypeStatistic records to monitor plugins \ custom workflow activities hosted in sandbox in CRM 2016 (and earlier)

CRM collects runtime information about the plugins and custom workflow activities executing in sandbox mode in PluginTypeStatistic records every hour or so.

Go to Advanced Find View and select – Plug-in Type Statistics

It gives us details regarding “The average execution time”, “Execution Count”, “Failure Count” etc. for each of the plugins and custom workflow activities.

Hope it helps.

“Create Dynamics Leads based on Tweets” using Microsoft Flow in CRM 2016

Microsoft Flow is a workflow management tool, using which we can create automated workflows between various services and apps.

With Dynamics CRM Online common scenarios could be

  • Create Dynamics CRM Leads from an Excel table.
  • When an opportunity is created post to Yammer.
  • Copy new Dynamic CRM Account to Common Data Model etc.

  • Below are some of the templates available for CRM Online

  • Let us take a Template that creates Leads based on Tweets

  • Connect to both the services

  • Configure it, for e.g. search for #msdyn365, get the Tweeter User Name and create the lead record. Map topic in lead with tweet text.

  • Check the status of the flow.

  • Leads created in CRM

Hope it helps..

Passing EnumType parameter in Web API in CRM 2016

Recently we were calling InitializeForm function through WEB API, to which parameters to be passed were

TragetFieldType EnumType values:-


The Parameters

Please refer the below link to get a good understanding on Web API

Hope it helps..

Notes on MB2-710 Microsoft Dynamics CRM 2016 Online Deployment Certification Exam

Today i took MB2-710 CRM 2016 Exam. Below are my notes that helped me in clearing the exam.

  • Web Browser requirements:
Internet Explorer 10, 11
Mozilla Firefox, Google Chrome, Safari Latest Version
  • CRM for Outlook 2016 requirements:
Windows 7 with SP1, 8, 8.1 and 10, Server 2012, 2012 R2 Remote Desktop Services.
Office 2010, 2013, 2016
Internet Explorer 10, 11
  • Phone requirements:
iOS 7, 8, 9
Android 4.4, 5
Windows Phone 8.1, 10
  • CRM for Tablet:
Windows 8.1, 10
iOS 6,7, 8, 9
Android 4.2, 4.3, 4.4, 5.0
  • User Subscription License types
Employee Self Service
  • Different Office 365 Admin roles.

  • One production instance is included at no cost with minimum of 25 Professional Licenses.
  • 5 GB of storage for all subscriptions.
  • No option of backup and restore of CRM on premise to CRM Online.
  • Data Loader Service – cloud based service to move data from files to CRM Online.
  • Office 365 is not required to purchase CRM Online.
  • During cancellation of subscription, cancellation fees might be charged and data will be deleted after 30 day. We can contact technical support to arrange for the backup.
  • Call support and provide billing administrator user name and password and other details for cancellation.
  • To disable a user in Online, simply remove the license of the user.
  • “Non-Interactive” user can be created for Programmatic access to CRM, the user doesn’t consume a license and for each instance 5 non-interactive users can be created.
  • We can synchronize Active Directory with Office 365 or can use ADFS for account administration.
  • Different Administrative roles à Billing Admin, Global Admin (System Administrator in CRM), Password Admin, Service Admin (System Administrator in CRM), User Management Admin.
  • Instances action à Switch, Reset, Delete, Copy.
  • Production instance cannot be Reset.
  • Sandbox instance can be put in Administration Mode and System Administrator and System Customizer role can sign in to the instance.
  • Full copy copies with Data and Minimal copy includes users and customizations only.
  • A tenant can have 50 Production and 75 non-production instance.
  • A tenant can only be federated with only one on premise AD and licenses and subscriptions are not shared among tenants.
  • Notifications are sent to administrators or any additional recipients configured when 80 % for storage limit is reached. If storage limit is reached no new records can be created. Here then data needs to be removed and\ or additional storage needs to be purchased.
  • New features\updates are delivered for CRM Online twice a year and needs approval from Customer.
  • Updates are approved/rescheduled at instance level.
  • OneNote notebooks are stored in SharePoint site so server based integration must be enabled and also at Entity Level Document Management and One Note integration should be enabled.
  • Skype integration includes both Skype and Skype for Business.
  • Office 365 Groups are for collaboration purpose between CRM Users and non-CRM Users.
  • OneDrive for business allows 1TB of storage space. Security role “One Drive for Business”.
  • CRM for Outlook for tracking email, appointments, contacts and tasks.
  • CRM 2015 for Outlook will work with CRM 2016 but only in Online Mode.
  • Only one organization can be used for synchronization, for non-synchronizing organization offline is not supported.
  • Fields that needs to be synchronized can be configured now. Works with outlook and server side synchronization but not with Email Router.
  • Existing record cannot be deleted or linked. New records can be created as drafts while working with CRM for tablets and phone app.
  • Privilege – “CRM for mobile” for CRM for tablets and phones and “CRM for phone express” for CRM for phone express.
  • Entities can be made read only for CRM for tablets and phones. All custom entities can be enabled for mobile apps.
  • Tabs, Section and fields can be hidden for CRM for Phone not for Tablet.
  • Multiple User and System dashboard can be enabled.
  • Server Side – Email router or server side synchronization and client side – Outlook Client can be used for Email Processing.
  • Email router cannot synchronize App, Contacts, Tasks created in CRM Outlook client.
  • Server side synchronization can be managed through web, provides error reporting and sync appointment, contacts and task.
  • Folder Level Tracking needs server side synchronization and folders to be under inbox. 25 folders per user account can be used for folder level tracing.
  • Emails are removed from the Forward mail box after processing unlike individual mail box monitoring.
  • Email address change to a user or queue needs to be approved. It can be disabled separately.

Please refer these articles for preparation

Hope it helps..

Alternate Keys in CRM 2015\CRM 2016

Let us look at a simple example to understand.

  • Suppose we have a custom entity name Demo Entity.
  • Create a new single line of text field named Alternate Key Field.
  • Create a new Alternate Key Field and specify the above field for it.

  • Click on “Create index for My Alternate Keys for entity Demo Entity” which will create an Index in CRM’s Database.
  • Let us update the following record using Alternate Key

  • Sample code

  • Updated record

  • Currently alternate key can only be defined on field type – string, integer and decimal.
  • The alternate key can be used for Entity Reference as well, wherein instead of specifying GUID we can now use alternate key.

Hope it helps..

Plug-in and Custom Workflow activity tracing in CRM 2015\CRM 2016.

To configure it,

Go to Settings – Administration – System Settings

Here we have selected “All” for enable tracing and registered a sample plugin which only writes trace.

Now perform the event that will trigger the plugin.

Go to Settings – Plugin Trace Logs

Open the Trace Log record

Trace message

In case of enable logging set as Off no trace log records will be created and in case of Exception only when exception occurs trace log record is created.

“Trace logs older than 24 hours are deleted by Bulk Deletion background job”

Hope it helps..

Using RetrieveEntityChangeRequest to track changes in CRM 2015 / 2016.

As a first step,

Enable Change Tracking for the entity, custom Demo Entity in our case here.

Suppose we have 5 records created for Demo Entity.

As we are calling it for the first time DataVersion is set as empty.

We got all the 5 records as new or updated item.

Save the DataToken to be used while determining the changes and to be passed next time.

Now let us delete Record 1 and Record 2 and update Record 5 and run the code again this time passing the DataToken saved

As expected we get 3 changes.

Now suppose we create a new record name Record 6 and still use the old Data Token

As expected we got 4 changes here, which includes the new record 6 as new or update.

Point to remember here is if no version is passed the system will return all the records as new, and system will consider records that are within 90 days, if it is older than 90 days all the records will be returned.

If we have a new record created and deleted before we retrieved for the changes and the record didn’t exist at the time of retrieval, we will still get the record as deleted.

Sample Code

EntityCollection newOrUpdatedEntityCollection = new EntityCollection();
EntityReferenceCollection removeOrDeletedEntityRefCollection = new EntityReferenceCollection();

RetrieveEntityChangesRequest retrieveEntityChangeRequest = new RetrieveEntityChangesRequest();
retrieveEntityChangeRequest.Columns = new ColumnSet();

// pass DataVersion
retrieveEntityChangeRequest.DataVersion = "1018501!10/24/2016 12:31:46";

retrieveEntityChangeRequest.EntityName = "new_demoentity";
retrieveEntityChangeRequest.PageInfo = new PagingInfo();

RetrieveEntityChangesResponse retrieveEntityChangesResponse = (RetrieveEntityChangesResponse)organizationProxy.Execute(retrieveEntityChangeRequest);

foreach (var entity in retrieveEntityChangesResponse.EntityChanges.Changes)
var dataToken = retrieveEntityChangesResponse.EntityChanges.DataToken;

if (entity.Type == ChangeType.NewOrUpdated)
else if (entity.Type == ChangeType.RemoveOrDeleted)

Hope it helps ..

“Insights for Microsoft Dyanmics CRM Online” Solution for CRM 2016 – Quick Overview.

To configure it –

Go to CRM Admin – Manage your Solutions and Install “Insights for Microsoft Dynamics CRM Online”

Once installed it will add a Web Resource to the forms for Lead, Contact, Account and Opportunity entity.

Click on Insights Organizational Settings in Insights Pane.

Configure the field mapping which can be used to update the CRM records.

Once done with Organization Settings, on opening an Account Record for e.g. Microsoft

Clicking on Show Firmographics brings company details.

Sync or Update allows to update the CRM record.

Edit button lets to select the correct contact\account etc. if incorrect

Flag can be used to report any incorrect information

Clicking on Insights or any other options opens up a new page.

Insights: –


Find Contacts:-

Selecting a contact, gives an option to add the selected contact as either contact or lead inside CRM.

In next blog posts, would try covering all the other aspects \ features of Insights solution.

Hope it helps..

CRM Manipulation Library – Custom Workflow Activities for CRM 2016


Recently we used the CRM Manipulation Library for some Days related calculation.

To use it in CRM 2016, we updated the references to use latest SDK assemblies. You could download it form here.

While working with it we found a strange issue,

If we are using Add Days and we do not specify any value to Days to Add it will not perform any calculation. The workaround suggested was to add 1 Week and remove 7 days, something of that sort. Basically, we wanted to add 2 minutes here.

Thanks to this post for that

Hope it helps..

How to – Delete Components from Managed Solution in Dynamics CRM 2016 without using Holding Solution.

Before the updates that we have received for solution in CRM 2016 the only way to delete components from managed solution was to use Holding Solution.

The following post nicely explains this.

Now let us see how we can do this in CRM 2016 without using Holding Solution.

Suppose below is our managed solution that includes 2 Action, 2 Entity, 2 SLA, 2 Workflow.

Entity 2 with two forms.

Entity 2 with 2 Views.

Entity 2 with two Fields.

Now import this solution as managed in destination org.

Now suppose we do not want following components in our Destination org – action 2, dashboard 2, Report 2, Security Role 2, Workflow 2 etc. along with View 2, Field 2 and Form 2 for Entity 2.

We remove some of the components and delete (field, form etc.) from our unmanaged solution (named Core Solution) which we had imported as Managed in our Destination Org.

Deleted View 2

Deleted Field 2

Now click on “Clone to Solution“. (This will increment the version number.)

Now import this updated solution to our destination organization, and select “Stage for Upgrade

Click on “Apply Solution Upgrade

This will remove the components from our destination org.

The helpful post

Hope it helps..

Nice Videos on understanding “Package Deployer Tool” and “Configuration Migration Tool” in CRM.

While going through various videos on Microsoft Dynamics CRM, found these 2 nice videos on Package Deployer Tool and Configuration Tool.

Do check it out

Hope it helps..

“​SharePoint Attachment Extractor & Metadata Manager” tool for Microsoft Dynamics CRM

Two of the most common requirements of the users while using OOB CRM and SharePoint integration have been

  • To associate some sort of metadata with the  document being uploaded from CRM
  • Moving attachments from notes of a particular record to the corresponding folder in SharePoint.

Finally we have a tool than enhances the Out the box integration between CRM and SharePoint and provides these features (in a fully supported manner)

Get all the details here :

The tool has been developed by one of my closest friends and now also a MVP for Microsoft Dynamics CRM – Debajit Dutta.

An error has occurred. {1} {0} while Importing Solutoin in CRM 2016 Online.


I was getting below error while importing solutoin in my trial CRM 2016 Online Org. I tried with other browser and it was the same case. Infact I created a new trial and tried there but no success.

Without losing hope, tried the same in one of my VM (Windows Server 2012 Standard). It got successfully imported.

So went back to my workstation and cleared browser cache there.

And the Import was Successful.

Hope it helps..

Configure Office 365 Groups in CRM 2016 Online Update 1

Go to CRM Admin Center à Solutions à Install the Office 365 Groups Solution

Once installed, go to Settings – Office 365 Groups to configure Entities.

We have enabled it for Account (select entity and Publish All)

Open the Account Record and navigate to Office 365 Groups.

It will auto create a Group or we can specify an existing one.

Once configured we can see the Calendar, Conversation, Notebook etc.

Hope it helps..

Configuring Company News Timeline in CRM 2016 Update 1

It is new feature introduced in CRM 2016 Update 1 for CRM Phone and Tablets that delivers news from Bing about the customers and categorize them.

Go to CRM Admin Center à Solutions to install the solution.

Once installed, open your mobile or tablet CRM App and open any of the existing Lead, Contact, Account or Opportunity record.

We could see all the news in Activity News.

In CRM App for Windows Phone à

Different categories available

Hope it helps.