The ‘distinct’ attribute is not declared error while trying to import solution in CRM 2016 (and earlier)


Got this error while trying to import a managed solution in CRM 2016 Online.

During analysis we figured out that it was pointing to one of the charts created for System User Entity. It seemed like chart’s xml was modified after export and then imported. The xml definition of the chart contained distinct keyword.

Removing the distinct keyword from the Chart definition and importing it back and then importing the managed solution with this updated chart got imported without any error.

Hope it helps..

MB2-712 Certification: (Microsoft Dynamics CRM 2016 Customization and Configuration) – Revision Guide

Microsoft Dynamics CRM and Unified Service Desk

I have been completing a series of posts to help people prepare for the MB2-712 certification (Microsoft Dynamics CRM 2016 Customization and Configuration. Here is a collection of links to all of these posts. I hope these might serve as a useful revision aid for the MB2-712 exam.

The MB2-712 certification is not easy to study for. At least in my opinion! The reason being the scope of the exam. CRM is a large product and therefore customizing it is a big topic. But a fun topic and one you will really enjoy learning about.

Revision Notes (Introduction)

Introduction / Overview to MB2-712 Exam

Configure Microsoft Dynamics CRM

  • Configure Dynamics CRM settings
    • Configure auditing, document management and collaboration; configure business units; perform user management; configure email; manage teams
  • Manage Dynamics CRM security
    • Understand security roles; define permissions and privileges; configure access levels; configure security roles; assign security roles; work with…

View original post 341 more words

Fixed: Cannot add a Root Component 00000000-0000-0000-0000-000000000000 of type 20 because it is not in the target system error while importing managed solution in CRM 2016.


Today we faced this issue while importing managed solution extracted from our Dev Environment to Test Environment (CRM 2016 Online Update 1).

As suggested by few of the posts online, the culprit was the System Customizer role. We removed it from our solution and then imported it back and it got imported successfully.

Helpful Post

Hope it helps..

IPluginExecutionContext Depth is 2 in Create Plugin during Import of records in CRM 2015 (and earlier)

We had one of our plugins on Create of Opportunity however during the import of the Opportunity record it was not working properly. We had the Depth check in our plugin code to check for infinite loop as the same plugin was being used for Update also.

After some debugging we realized that Depth value is 2 instead of 1 during import.

To test this, we created a sample plugin for create of Test entity record and then imported the Test entity records.

As expected the import failed and we got our custom exception in it.

Hope this helps..

Sample code to update Access Mode of System User in C# (CRM 2016 or earlier)

Recently had a requirement to set Access Mode of around 500 users to Administrative from Read – Write. We wrote an on demand workflow for that. However, running that workflow on those 500 records in a batch of 100 records was causing them to stuck in waiting stage and we had to then manually resume those workflow instance. So we ended up writing a Console Application for that.

   QueryExpression queryExpression = new QueryExpression();
            queryExpression.EntityName = "systemuser";
            queryExpression.ColumnSet = new ColumnSet();

            ConditionExpression conditionExpression1 = new ConditionExpression();
            conditionExpression1.AttributeName = "tk_businessarea";
            conditionExpression1.Operator = ConditionOperator.Equal;

            ConditionExpression conditionExpression2 = new ConditionExpression();
            conditionExpression2.AttributeName = "isdisabled";
            conditionExpression2.Operator = ConditionOperator.Equal;

            // access mode ==> 0 --> Read Write and 1 --> Adminstrative
            ConditionExpression conditionExpression3 = new ConditionExpression();
            conditionExpression3.AttributeName = "accessmode";
            conditionExpression3.Operator = ConditionOperator.Equal;

            queryExpression.Criteria.FilterOperator = LogicalOperator.And;

            EntityCollection entityColl = organizationProxy.RetrieveMultiple(queryExpression);
            foreach(var entity in entityColl.Entities)
                Entity userEntity = new Entity("systemuser");
                userEntity.Id = entity.Id;
                userEntity.Attributes["accessmode"] = new OptionSetValue(0);

Hope it helps !!