Why developers should use code analysis to keep code quality high

Programming is like sex. One mistake and you have to support it for the rest of your life. Michael Sinz


The battle against bad code is a never-ending one and it’s important CRM developers keep code quality high.

These blogs talk about the effects of bad code

One of the causes of bad code is rushed projects and tight deadlines, developers need to have integrity and not let leave a CRM developers stranded.  You can stop bad code by writing code like a boy scout and having passion for CRM development

It takes effort from all developers to keep code quality high, developers need to refactor their code and peer review the code of junior developers.  If the code is a high standard, developers will check in high quality code but as soon as poor quality code is in the source repository other developers will think it’s OK.
CRM developers should monitor code to make sure it’s of a high quality and all companies should have and implement coding standards document.
CRM developers should use static analysis tools to check their code as part of the process of checking code into source control.
To keep code quality high you should
  • Write unit tests
  • Use static analysis tools
  • Code reviews
CRM developers should write unit tests and review their code using static analysis tools like FXCop, StyleCop, Resharper, Visual studio static analysis.
  • Get into good habits
  • Junior developers learn correct formatting
  • Create quality code
  • You will thank yourself in the future
  • It reminds all developers to tidy up their code

Re-Sharper is a great tool and once you have tried it, it’s difficult to go back – CRM Developers tools of the trade – Resharper

Writing unit tests and checking and correctly your code using code analysis tools seem like extra work which one reason developers don’t like using them but it allows you test the logic of your code and for all developers to refactor the code and test if it’s still working.

Writing unit tests and analyzing and fixing code seems like you are not progressing because you are not writing new code but you are creating quality code and quality code will take less time to interact with in the future.

Bug fixing, understanding, extending and modifying is easier and quicker with quality code than it is in legacy code.  If the code is consistent between different programmers it’s easier to read and maintain –  Why your CRM code and customizations should be simple.  Static code analysis helps to make sure all code written but different developers conforms to the same standards and is similar.

A good example is bug fixing legacy code with huge methods, it’s difficult to understand and tricky to fix, Are your CRM plugins creating technical debt?


When you first analyse your code

When you first analyse you code you will get a lot of warnings and I mean lots.  If you run the analyser on a legacy project or project with a lot of code (and hasn’t been analysed before) you will get a lot of warnings.

My advice is to start small and just use this on the code you have been recently creating/changing.

Don’t take the warnings personally, view the warnings like someone code reviewing your code and giving your tips on how to create better code.

Remember they are warnings, you should see them as recommendations, in some situations is OK to ignore a warning if you have a good reason for it, this is better than not knowing there was a potential problem.

My Experience

I am a continuous learner, I like learning, I like improving and getting feedback on your code is a good way to learn, I believe in continuous learning and improvement.

Finish work a litter wiser about CRM than you when you started work.  – Hosk

When I analysed the code I got lots of warnings but I found these interesting.  I wanted to know the logic behind the warning.

It’s easy to be initially overwhelmed and condemn the analysis as being too pedantic.  In some recommendations it can be but if you can prove your reason for ignoring the warning (with something more than I can’t be bothered to change it).

Over time I found myself writing code which I knew would not generate complaints from the static analysis tool because I didn’t want to have to go through the code and correcting it.  This shows me static analysis is an effective tool in changing my the syntax of the code I was writing.

The goal of static analysis

Creating standard code syntax and get the team to deliver a minimum standard of code.  Developers can get lazy and like to quickly check in code, running static analysis is a good tool to nudge developers to tidy up their code.  Static analysis is like running a spell and grammar check on your code, it finds areas you can polish your first draft.

Static code analysis also finds common bad coding practices and highlights poor code design.

Look at the default areas the default rule set checks

  • Design
  • Globalization
  • Interoperability
  • Maintainability
  • Naming
  • Performance
  • Portability
  • Reliability
  • Security
  • Usage
  • Native
  • Errors

I had some errors telling me to hide public variables.

CA1002 – Do Not expose generic List

CA1822 – Mark members as static


 Members that do not access instance data or call instance methods can be marked as static (Shared in Visual Basic). After you mark the methods as static, the compiler will emit nonvirtual call sites to these members. Emitting nonvirtual call sites will prevent a check at runtime for each call that makes sure that the current object pointer is non-null. This can achieve a measurable performance gain for performance-sensitive code. In some cases, the failure to access the current object instance represents a correctness issue.


Why was I getting this error, this articles help to explain

CA1822 Code Analysis warning

Can anyone explain the purpose and resolution of CA1822 on a Controller Action?

It’s ok to ignore some errors

I was getting an error CA1011 – Consider passing base types as parameters

I was passing in an early bound type e.g. contact and it was saying I could pass in entity.  I’m happy to ignore this warning for CRM early bound classes because I the method needs a contact record and isn’t going to work with a different one.  I want this type checking on the method.

What did I make of it

I found the process interesting.  As I went through the warnings I would think about the design of the code and the merits the warning and suggested action.

The key to making this productive is to understand why it’s warning you.  To do this I had to paste the warning into the internet and search for blog posts or usually forum posts discussing the warning.

Most of the warnings made me change the code for the better, it made me think about what the code was doing.  Its tedious to begin with because there are lots of errors but over time the number of errors reduces and you code becomes more standard and following best practices.

Given time I would recommend a CRM development team keep updating the rules and turning off the ones which aren’t relevant.  This would generate a set of standard rules your code should follow.


I think all CRM developers should have static code analysis running on their code, it will help you keep your code tidy and uniform.

CRM development teams should spend time updating the rules run for CRM code and turning off the rules which are not relevant.  If you had time it’s possible to create new rules.

Developers should run static analysis on their code and I would recommend all code goes through a code review, the threat of a code review will help ensure code is kept at a high level.

Code reviews are a great way for junior developers to learn from senior developers.

Further reading

What is a static analysis tool

Using Rule Sets to Group Code Analysis Rules

Analyzing Managed Code Quality by Using Code Analysis

Improving Quality with Visual Studio Diagnostic Tools

Code Metrics Values


CRM 2016 – Tips on passing the MB2-712 customization and config exam

Time is not measured by the passing of years but by what one does, what one feels, and what one achieves.

Jawaharlal Nehru

A new version, a new customization and config certification to pass, this is the 5th Customisation and config exam I have done

I took the MB2-712 exam in June and you can read my thoughts on the MB2-712 – Microsoft Dynamics CRM 2016 Customization and Configuration certification

If you are not sure if you should take the certification I will persuade you why you should take and pass the Configuration and Customization Certification, the quick answer is certified CRM professionals get paid more.

Resources I used

There are lots of resources to help pass the CRM 2016 config and customisation certification, I will explain the ones I used.

Self Paced Online course

Read and understand the official certification criteria by going to the certification page – https://www.microsoft.com/en-gb/learning/exam-mb2-712.aspx

I used the self paced online course (you have to work for a CRM partner to use this)

80729: Customization and Configuration in Microsoft Dynamics CRM 2016

Make sure you go to resources, you can download the slides, these are good because you can read these quickly and they give you some facts.

CRM Trial

The real value of the certification is the knowledge you acquire whilst revising for it, don’t just learn enough to pass the certification but learn how the functionality and features really work.

Use any functionality you haven’t used before, experience is the best teacher.

I watched the videos, searched the internet and setup a CRM trial and used the functionality I hadn’t used before.  Below is what I learnt about Themes

CRM 2016 – What you need to know about Themes

Hosk Study Notes

Hosk CRM 2016 study notes

MB2-712 – CRM 2016 customisation and configuration Hosk study notes

You can also use my CRM 2013 study notes because it covers many areas in the CRM 2016 like solutions, fields, security, etc.

Also read my Tips on passing blog posts

Neil Parkhurst revision guide

Neil Parkhurst has a great collection of blogs posts on topics covered in the exam, this is a great free resource

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

Other blogs

How to evaluate job offers for Microsoft Dynamics 365 roles


Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do.

Steve Jobs


It‘s likely as a Microsoft Dynamics CRM professional you will move jobs several times, particularly with recruitment consultants on LinkedIn sending potential jobs to CRM professionals on a regular basis.

What should you consider when evaluating job offer’s, why should you take one job offer over another?


We keep moving forward, opening new doors, and doing new things, because we’re curious and curiosity keeps leading us down new paths.
Walt Disney

In this article Job Hopping Is the ‘New Normal’ for Millennials: Three Ways to Prevent a Human Resource Nightmare has a great quote

Ninety-one percent of Millennials (born between 1977-1997) expect to stay in a job for less than three years, according to the Future Workplace Multiple Generations @ Work” survey of 1,189 employees and 150 managers. That means they would have 15 – 20 jobs over the course of their working lives!

The Dynamics recruiters Nigel Frank do a survey of Dynamics professionals every, it has a lot more detail than just the average salary Dynamic CRM Salary survey 2016

34% plan to leave their current job within 12 months (if you listen carefully you can hear recruitment consultants cheering)

34.3% said the reason to move job was lack of Leadership & vision

You need to manage your own career because it‘s unlikely you stay at one company for your whole career you can’t let your employer manage it.  The question of who you work for? is important because you work for yourself and you should ensure you are doing what’s best for your career. 

Identify your dream job and work out

  • What skills and experience do you need for that job
  • Who do you need to network with
  • What is the career path to get to the dream job

People struggle to come up with an answer or don’t know their dream job, it‘s difficult but you should persist., this questions can help

  • What roles have you enjoyed working in?
  • What roles don’t you like?
  • What have you enjoyed doing in your job?
  • Do you like the technical side of Dynamics CRM jobs e.g. coding?
  • What job do you see yourself doing in 5 years, 10 years?

here is a list the common Microsoft dynamics CRM roles, do any appeal?

Senior/Lead Developer
Solution Architect

You will need to climb the ladder of Junior, standard and senior for most roles.

The more thinking you do the closer you get to understanding what you like and don’t like and what your dream role will involve doing.

Once you identify your dream job you can work backwards and plot your route and make a plan.  You can use this information with you current employer and work out ways they can help you get the relevant skills and experience in your yearly appraisal.

When you know you perfect job, you can focus your time and effort in moving towards that role.

Don’t just move for more pay

You should know the average wage for your current position and the wage for roles you applying for, knowing the average wage is a useful bargaining tool to take into your review.  It gives an anchor to the discussion and offers an impartial view of an average wage in the industry.  If you move somewhere which is paying below the market average then you could get more if you moved somewhere else.

Money is important and you should make sure you are getting the going rate for you position but money won’t make you happy in a role.

Money isn’t the most important factor, unless you find out someone in the company is getting paid more than you for the same role #HoskWisdom


Money will stop motivating you and there are many other aspects of the jobs which can make work enjoyable.  

You are at work at least 8 hours a day, you should try to ensure you are doing work you enjoy.

What to consider on job offers

When you have a job offer(s), compare the job offer(s) with your current job.  I like to make a list of the pro’s and the con’s of each position and give them a value between 1-10.   I use a general list (below) and add extra points if they are relevant.

I use a list because it allows you to compare different roles using the same criteria and give more points to factors which are important to you.

This list below is useful as a guide to help you create some questions for the company before your interview.

Job role

Role is important because what you will do and the experience you will get from the role.


compare salary and benefits

Career progression

What is the potential for career progression, what is the companies view of promoting internally.  How do your bosses see your potential and future at the company.


What experience will you get in the role, what projects you will be working on.   Experience can be measured on project size, role, technologies used.


What is the culture of the company? does it fit with how you like to work and your values.


Location is important because if you can reduce commuting time you will save hours of your life you can spend with your family, friends or doing something else

Company size – Pond size

Do you want to work for a big company or a smaller company?  This will effect your impact on the company, in a small company you will have responsibility because there isn’t anyone else to do it.

Larger companies have bigger resources and usually pay better but you might have to accept you are a smaller fish in a big pond.


How is the CRM team structured?

Learning potential

What is the potential to learn at the company?  Is there training material, will you go o n training courses? are there senior CRM professionals for you to learn from?

This blog has some other factors to consider

16 Factors to Consider When Comparing Two Or More Job Offers

You can add other points to consider, the list above its a list to start with.

List done, then what?

Once you have created the list you should have a score for each role and this can give you something to think about.

I recommend sleeping on it and looking at the results of the list again the next day.

Do some research on the company and see if anyone in your network has worked there or is currently working there, they will be able to give you a first hand account of what its like.

Talk the decision through with other people in your network, other people can often give you a considered opinion and can often give you a different perspective on your different options.


Finish a role the same way you started the role with enthusiasm and effort.  You will be asked for a reference and you may work again with the company or quite likely with some of the people from the company.  People who leave jobs badly are not easily forgotten

Why do people stay in boring jobs?

 If you are going for an interview make sure you read the blog post below

Microsoft Dynamics CRM Developer Interview Questions

CRM 2016 – How to find what users have what roles

It is only in adventure that some people succeed in knowing themselves – in finding themselves.

Andre Gide


Moving users from one CRM online instance to another CRM online instance can involve many tasks and one of the key tasks is setting up the users with the correct security roles.  This article looks at a recent experience I had moving users from one CRM online instance to another.

Related Hosk CRM blog posts

Here are some other blog posts I have recently written around setting up a CRM environment and moving data between them.

Moving users is not straight forward

This isn’t straight forward.  I will focus on just security roles here because my instance is simple but you should consider other security concerns

  • Access team templates
  • Business units
  • Hierarchy security
  • Field Level security

At lot of this data is configuration data which must be setup for each instance, in a similar way Microsoft Dynamics CRM configuration settings must also be setup.

Security roles are linked with Business units and every business unit has its on version of the security role.

If you are writing Javascript or advanced find and select a security role , you will get results back for each business unit. If you write Javascript checking for security roles you need to use the security rule name.

The XrmServiceToolkit which is a JavaScript framework with built-in functions, makes looking up security role easy as you can see in the blog post below

Simple Way to Check if a User Has a Security Role Using the XrmServiceToolkit/JavaScript

Good practice is not to individually tweak security roles for each business unit, this is possible but will be confusing and you can only export security roles at the root business unit.

If you are setting up users you need to first setup business units

  • Business unit
  • security roles

The security roles are imported using solutions and the security roles will be exist on the default business unit.  Business units cannot be included in solutions so you need to import or create Business units in each CRM instance (amount setting other configuration data).

If you use Business units in workflows it’s important to keep the same guids between CRM instances

What roles do users have?

You can import users into a new CRM instance but you have to assign the security roles manually and the first step is to understand what roles users have.

Finding current user roles

Sales –> Reports

CRM 2016 - user roles

There is a report called user summary, it’s a bit like the Millennium Falcon, it’s not much to look but it can help to bring down the empire.  It shows each users and what security role they have.  It can be difficult to use so you might find it easier to export to Excel

user summary

Advanced find

CRM 2015 – Advanced find to return all enabled users with a security role

a little tweak to my earlier Advanced find query and it then brought back all users with a specified security role.  The downside is you would need to do this for each security role.   (talking of advanced find you should definitely read this – Why the advanced find is a CRM Developers best friend)

The example below shows finding all the users with the security role System Administrator

CRM 2016 - user roles 2

Manage Roles – Assigning security roles

Once you have created your users, Business units and imported your security roles, it’s time to assign users the correct security roles.  (*note if you have teams, you will need to do these in a new CRM instance).

You can assign individual user to by navigating to the user and clicking Manage Roles button

assign users

select the security roles you want the user to have and press OK

assign users 1

If there are lots of users then assigning security roles individually takes a long time, so you need to do some bulk updating.

Navigate to users

Settings –> Security –> Users

Then use a list to select the users you would like to bulk update

Select the users you want to update

press Manage Roles button

select the roles and press OK

XRMToolBox – User Roles Manager

There is a great tool in the XRMToolbox called the User Roles Manager

XRMtoolbox - user role manager

It’s easy to use and allows you to add one or many security roles to one or multiple users.

Select security roles and users XRMtoolbox - user role manager 1

Press action, which gives you three options

XRMtoolbox - user role manager 2

It has pretty much the same functionality but is easier to navigate and faster to use.  The bonus is you don’t need to open Microsoft Dynamics CRM so you can have it open with a list of users.


Hosk’s Top CRM Articles of the week – 14th July


Strength and growth come only through continuous effort and struggle. Napoleon Hill


  • Every purpose needs a life #HoskWisdom
  • A company can save money on all parts of the business, but never on ideas#HoskWisdom
  • Training and learning are not the same thing. Many people learn nothing from attending training sessions. #HoskWisdom
  • Learning can happen anytime and anywhere you want it to #HoskWisdom
  • Stay curious and question everything #HoskWisdom
  • A CRM project is a way to align your business objectives with a CRM solution #HoskWisdom
  • Look to the future for opportunities no one else can see #HoskWisdom
  • Curiosity leads people to opportunities, courage turns opportunities into success #HoskWisdom
  • If you think you are always right, then you are wrong more than you know #HoskWisdom
  • If you want to make strategic decisions you must make time to think #HoskWisdom
  • Tell customers what to expect in their CRM projects so they don’t overreact to bumps in the road #HoskWisdom
  • Concentrate on the value, not the price of things #HoskWisdom
  • The value of a CRM project to a customer should be more than the price #HoskWisdom
  • Justify the price of a CRM project, do not apologise for it #HoskWisdom
  • You don’t get requirements from companies you get them from people #HoskWisdom
  • Defeat can either break you or strengthen you #HoskWisdom
  • If your CRM solution isn’t easy to use then the end users won’t use it and your CRM solution has failed #HoskWisdom
  • Excellent CRM projects are not created by accident #HoskWisdom
  • Don’t be surprised when mistakes happen during a CRM project, be prepared #HoskWisdom
  • You are unique and that is your greatest strength #HoskWisdom
  • Having a fried egg and a scrambled egg on the same plate somehow feels dishonest to eggkind #HoskWisdom
  • A lack of mistakes is more worrying than making mistakes, it means you’re not trying new things #HoskWisdom
  • Mistakes don’t hurt as much, when you learn from them #HoskWisdom
  • When ever you have to edit a web config there is always trouble #HoskWisdom #YeeWisdom
  • Put employees first and customers second, if you want your employees to give great customer service #HoskWisdom
  • You can achieve a little on your own or a lot with a team #HoskWisdom
  • When you criticise failure, you discourage innovation #HoskWisdom
  • Never look down on people who look up to you #HoskWisdom
  • If you think you know enough to stop learning, you have more to learn than you think #HoskWisdom
  • All I want is the people who like Peanut butter and Marmite to toast together in unity but with seperate pieces of toast #HoskWisdom
  • Time is your best friend and your worst enemy #HoskWisdom
  • if eating books transferred the content to my brain and they tasted like bacon, I would be a genius #HoskWisdom
  • Give a team direction and a sense of purpose and they will give you effort, engagement and results #HoskWisdom
  • Working with Microsoft Dynamics CRM, you always need to have fun, improve, deliver projects and make customers happy #HoskWisdom
  • Before you do anything, always stop to think #HoskWisdom
  • Don’t teach people want to think, teach them how to think #HoskWisdom
  • You can’t beat the great feeling when you find someone has already written a method which does exactly what you want to do #HoskWisdom
  • Great achievers motivate themselves #HoskWisdom
  • You are always a student of life, there is always much to learn #HoskWisdom
  • Life is short and time is fleeting, make it count and avoid all meetings #HoskWisdom
  • Shifting goals creates frustrated employees #HoskWisdom
  • A teams purpose, is it’s primary motivation #HoskWisdom
  • Every time you work on a new CRM project, you evolve #HoskWisdom
  • Each project has its own style and rhythm, you have to find the best way of working with the people involved #HoskWisdom
  • To be a great leader you must serve the people you lead #HoskWisdom
  • Your actions should help you get to where you want to be #HoskWisdom
  • Don’t just get opinions from people but understand their reasoning process #HoskWisdom
  • Understanding the way people form their opinions is more useful than their opinions #HoskWisdom
  • It’s not OK to hide from the truth, but you are allowed to be scared of it #HoskWisdom
  • You can’t control when you make a mistake, you can control how you react to making a mistake #HoskWisdom
  • The reward inside every mistake, is knowledge to change your approach #HoskWisdom
  • knowledge is a quest, mistakes are a mere flesh wound #HoskWisdom

Want more #HoskWisdom then follow #HoskWisdom or follow @BenHosk

Articles of the week

Option-Set, Lookup or Autocomplete

This is an old post by I stumbled across this week and its interesting

CRM 2016 – What’s the best way to organise solutions in Microsoft Dynamics CRM 

How you should organise your CRM solutions is a question that comes up a lot, the post discusses various methods.

Useful articles of the week

Microsoft Dynamics CRM User Guides

A link to loads of CRM users guides

free ssl certificates

You can get free SSL certificates, awesome

Best of the Rest

CRM 2016 – The importance of keeping the same guids between CRM instances 

PowerApps and the Microsoft Common Data Model

MB2-712 – CRM 2016 customisation and configuration Hosk study notes 

Why you first time fix rate is so important

CRM 2016 – How to enable languages

Create solutions that support multiple languages

Lessons Learnt: Understanding End-Users and Process for an Effective Dynamics

CRM 2016 – Failed to generate excel 

Lessons Learnt: Understanding End-Users and Process for an Effective Dynamics CRM implementation

Fast vs. Furious: PowerBI + Dynamics CRM Avoid this common mistake and watch your data fly!

Field One Sky good 2 know

Web Resources Best Practice – Organize Web Resources in Dynamics CRM

CRM 2016 – XRMToolbox plugin store error – Unable to load one or more of the requested types 


CRM Asynchronous Service Performance: Code Mania

CRM 2016 – Import error – A validation error picklist is outside of the valid range 

Migrate Dynamics CRM On-Premises to feature-rich Dynamics CRM Online

Dynamics CRM and Azure Scheduler – The final pieces of the puzzle

Dynamics CRM and Azure Scheduler – Breakthrough!

Dynamics CRM and Azure Scheduler – a closer look at Azure Web Jobs


What do leaders really do

Did Microsoft Acquire LinkedIn for the Cloud Business? (MSFT, LNKD)

Uber will ease the transformation to self drive cars

Azure rising: Microsoft will be largest Infrastructure as a Service vendor by 2019, says new Morgan Stanley survey

An Algorithm for Solving Problems

The Management Thinker We Should Never Have Forgotten

The Hosk currently reading

The Hosk – just finished reading

TED Talks: The official TED guide to public speaking

7 out of 10.  Great book, easy to read and great advice.  It’s written in a way which felt like the author was giving your advice before giving a TED talk.  It’s not ground breaking advice but it changed the way I thought about creating presentations and blog posts

  • Create a powerful, intriguing start to your talk, capture the audiences attention from the start
  • Finish strongly, this is what most people will remember
  • Focus on making the talk interesting
  • Use interesting pictures and few words
  • Practice your talk alot

Paisley: Smile On Me And Guide My Hand

6 out of 10.  Good read but got a bit boring when the author kept writing the team sheet and going through too many individual matches.

An interesting read for Liverpool fans.  I am interesting in the dynamics of successful teams and how managers lead them and create a great team spirit.

Bob Paisley was one of the most successful managers of all time, winning 2.1 trophies a season.  Great leaders make things simple.

If you want to learn more about Bob Paisley and CRM, read the blog post below.

If Bob Paisley managed a CRM team

Useful Hosk Links

Hosk list Of CRM 2013 Tools

A list and review of CRM 2013 tools, this will probably work in CRM 2015 as well

Hosk’s CRM Developer Articles

A collection of my favourite CRM Developer articles I have written

MB2-703 – CRM 2013 Customization and Configuration Certification Information

All the CRM 2013 content to help you pass the exam

CRM 2016 – How to reassign all records of a user

If you want to build a ship, don’t drum up people to collect wood and don’t assign them tasks and work, but rather teach them to long for the endless immensity of the sea.

Antoine de Saint-Exupery

Moving all the data, users and customizations from one CRM 2016 online instance to another, one thing you need to consider is users, creating the users and record ownership.

In Microsoft Dynamics CRM you cannot delete user records, the mantra for Microsoft Dynamics CRM is You don’t delete records, you disable them

Some developers can get annoyed about not being able to delete users and go to drastic measures of deleting the users in the SQL database (if it’s on premise).   DONT DO THIS!

When users are added to Microsoft Dynamics CRM, background tasks are kicked off and the user is added to the business unit team and a bunch of other stuff.  If you manually delete the user then there will be links to the users guid in the system but with no user to link to.

This is why you use the CRM SDK because it will add, delete and update records in the correct way which triggers necessary background tasks.

This is an unsupported customisation, when you sign up to become a CRM developer you should be made to sign the oath – I can view the Microsoft Dynamics CRM database but I am never allowed to change it’s values directly.

If tempted to use unsupported customisations read this, Why you shouldn’t put unsupported customizations in Microsoft Dynamics CRM

The quick answer is Microsoft won’t support your CRM if something goes wrong, even if the fault is a bug in Microsoft Dynamics CRM.  Putting unsupported customisations is basically invalidating your warranty for support.

What users?

You can’t delete user records but this doesn’t mean you need to take across the disabled users across to your different CRM.   Looking at the user records I found many of the disabled users had left the company.

You can easily find these disabled users by using the view Disabled Users.  If you are not going to take these users to the new tenant then you need to think about assigning the records because if you copy the records and the user guid isn’t there, you might get an error.

I wanted to take the enabled users but something to remember

Disabled users can still own records

Usually when you export and import records, if the process can’t find the user then it defaults to the user which is importing the records.  Is this correct or should another user own those records.

It was important I assigned the records to the correct owner in the old CRM because in the new CRM online I wouldn’t be able to tell what records were owned by different disabled users, all the records would be assigned to the importing user.

User records

When I started thinking about what records a user might have

  • Account
  • contacts
  • activities
  • emails
  • leads
  • etc, etc

You might think how will you find all the records a user owns, thankfully Microsoft have a very useful Reassign records button on the user record

Reassign All

get yourself over to users – Settings –> Security –> Users

On the User record you will see a Reassign Records button

CRM 2016 reassign all records

CRM 2016 reassign all records 1

When you press the button it must reassign it will reassign the records and pops up this message

CRM 2016 reassign all records 2

When all the records are assigned the message disappears.

One thing to note, there is no way to know which users you have assigned records so you have to monitor this yourself.

For some reason when I reassigned some users and then clicked on another user, I got an error when trying to reassign those records.

CRM 2016 reassign all records 3

To resolve the problem I had to refresh my browser.  I’m not sure the cause of the error, my guess would be perhaps the plugin (or what ever does the reassigning) was already executing or perhaps the table was locked.

Workflow users

You must make sure users who own workflows are not disabled or have the license removed because this will stop the workflow from running.

Workflow’s suddenly not working is not a problem when moving from one CRM instance to another because the workflows get assigned to the user importing the solution file.

This is a problem in existing CRM instances when a user leaves the company, when you disable the users and/or remove their CRM licence any workflows they have running will stop.

Creating the users

With office 365 and Microsoft Dynamics CRM online adding users is a four step process.

  1.  Add the users into Office 365
  2. Assign the users CRM licences
  3. Assign the users to the correct business units
  4. Assign the users security roles

Office 365 does allow you to bulk import and allows you to download a template.

Once you have created the users then you can assign the records and the records can keep their original owners

CRM 2016 – How to enable languages

You can never understand one language until you understand at least two.
Geoffrey Willans


Someone asked why can I only see English as the available language?


Microsoft Dynamics CRM support multiple languages and has language pack you can install and enable, this article will talk about how to do it and the differences between CRM Online and CRM on-premise


You select the base language when you create you a CRM instance, like the base currency this cannot be changed.

If you want more languages available to users, you need to install language packs and these install more language settings onto the CRM server.

Language translation works by all the text fields in Microsoft Dynamics have a guid/unique reference and Locale ID.  The language the user selects in their personal settings format options will set the Locale ID (LCID) also known as loc code

You can see the list of all LCID’s here – Locale IDs Assigned by Microsoft, below are some examples

  • English – United States 1033
  • English – United Kingdom 2057
  • German – Germany 1031
  • French – France 1036

CRM On-Premise

For Microsoft Dynamics CRM On-Premise  you need to download language packs and install them.

Instructions for CRM On-Premise are found in the links below

Install and enable a Language Pack

Install or upgrade Language Packs for Microsoft Dynamics CRM

The language pack can be downloaded here

I believe it downloads all the language packs and then you need to select the specific country, which means you need to know the LCID code for the language.

CRM Online

So how do you install language packs for CRM online when you don’t have access to the server to install the language pack?

It turns out it’s easier.

Navigate to

Settings –> Administration -> Languages

Install Language pack

Then you see a list of languages and all you need to do is tick the one you want

Install Language pack 1

but be warned this can take several minutes and disrupt access to Microsoft Dynamics CRM.  I’m guessing it’s a bit like installing a Solution file and something you want to do out of hours.

Install Language pack 2

You press OK and then it loads the language and it will take a few minutes

Install Language pack 3

How to select a language

Once you have imported the language, it will then be available to user to select in their personal settings.

It’s important to note, this is a personal setting and not a system setting, you cannot change the language for CRM, it’s stuck on the base language

click the cog on the top right –> Languages

Install Language pack 4

You can set the user interface language and the help language, it’s possible to set these to different values if you want.

Other Language considerations

I remember working on a CRM 2011 project and having problems with OptionSet, these caused problems with multiple languages because the values in the OptionSets were not translated into different languages.

I did a quick internet search and there is some great material on this and Microsoft have a solution to this


CRM 2016 – What’s the best way to organise solutions in Microsoft Dynamics CRM

The trouble with organizing a thing is that pretty soon folks get to paying more attention to the organization than to what they’re organized for.

Laura Ingalls Wilder


I was asked what is the best way to organise customisations in solutions, should I use one solution or many?Like most aspect of development, there are best practices to follow but there isn’t a single best way to do anything which you can use on every project.  

There isn’t a best way to organise your CRM solutions because you should organise your solutions the best way for each project, based on the project.

The answer to this question is it depends on the project

In this article I will discuss the different ways to organise CRM solution and the advantages and disadvantages of the different solution architecture.

No Best way

Developers spend hours arguing about the best way to write code, design code, build, deploy and the reason these debates rage on because there isn’t a best way.  Some methods are better suited to particular situations but not one suited to every situation.

Writing plugins in Microsoft Dynamics CRM has many best practices such as using early bound code, I would argue in most cases you should use early bound code, it‘s easier to read, it captures validation errors and has minimal effect on the size and execution time of the plugin.  There are times when it‘s good practice to not use early bound code when you write a plugin which will be triggered by multiple entities.  It depends on the requirements.


CRM developers need detailed knowledge of solutions, such as

  • What is a managed and unmanaged solution?
  • What can and can’t go into a solution
  • How do solutions merge together?
  • What happens when you delete a managed and unmanaged solution?
To learn about solutions read my post Overview of solutions

Solution patches

CRM 2016 brought in solution patches, which allows you to take part of solution and create a patch of it, copying out a smaller part of a larger solution.  For more information on solutions check out the links below

This video from Dynamics CRM tip of the day walks you through patchesPatches allows you to choose components and sub-components.  This allows you to select individual fields and not all fields, reducing the time to deploy and potential conflicts.

Patches allows developers to update a small part of the CRM solution, create a patch and deploy those changes.  Previously if you wanted to update an entity, you had to take all the fields, all the views and other related components for the entity.As with all customisations be consistent in a CRM project.

Solution problems

solutions can cause problems, some common problems are

Solutions can get out of sync because developers added fields on the development environment and QA environment.

Managed solutions problems with out of sync solutions

Out of sync problems can be avoided by using only one route for customisations being created, starting with DEV and flowing through the CRM environments until you get to production.

you can find common questions on solutions in thetwo blog posts below

Questions on Microsoft Dynamics CRM solutions and environments

other blog posts on solutions


CRM solutions such as workflows and plugins  configuration records in Microsoft Dynamics CRM, if the guid is different between CRM instances the workflow and plugin won’t work.

The blog post below discusses how you can copy data between CRM environments and keep the same guids

CRM 2016 – The importance of keeping the same guids between CRM instances

The article discusses the Dynamics CRM Configuration Data Mover v1.10, a good way to move configuration data between CRM environments keeping the same guids.

Release management and deployments

Solutions are the main mechanism to move customisations from one CRM environment to another,  best practices for CRM deployments but these focus on the manual deployment process.  Manual deployment process has been used on the projects I worked on because no project manager or CRM practice wanted to invest time in investigating and setting up automated and scripted deployments.

This is a mistake, CRM deployments should use the SolutionPackager and packagedeployer which automate deploying and data, saving developers from the boring task of deploying, reduce errors and remove data errors.  This is a gap in my knowledge which I plan to investigate.

If a development task can automated, it should be automated #HoskWisdom

Solution architecture in my experience

Below I list the different methods of organising solution on projects I worked on.  These projects were CRM 2011, CRM 2013 and CRM 2015 and before patch solutions.

Release/version/sprint Solutions

You can organise solutions to releases/phases/sprints, including the changes for each major release of functionality.  During development it’s easy for developers to work with the solution.  Developers with experience of the project will find release/sprint solutions easy to understand but new developers won’t find the solution content obvious.

The release solution can lead to many solution files because solutions are not reused but it can stop solution files becoming too large.

  • Release
  • Release
  • Release


  • You see what changes were in each release/version/sprint
  • You deploy smaller solutions, containing only customisations which changed
  • It’s easy to understand


  • You can end up with ever-growing collection of solutions
  • It can take a long time to create new environments because you need to import each solution in order
  • The solutions depend on previous versions
  • Solutions can be confusing because they don’t contain all the customisations being used, it’s difficult to navigate to the right customisation

Solutions by customisation type

A few projects organise solution files by customisation type

  • Entities
    • Entities and fields
    • Lists
    • Forms
  • Code
    • Javascript
    • Plugins
    • Workflows
    • Custom workflows
  • Reports


  • Easy for developers to understand where to put customisations


  • The separate solutions are dependent on each other
  • More solutions, more time deploying

One Solution

You just have one solution containing all customisations


  • Simple
  • Simple to navigate


  • The solution can grow in size and there are some size restrictions
  • Potentially complex having all customisations in one solution
  • The solution can take a long time to import
  • Historically there are problems with solution timing out (before CRM 2016)

Other solution strategies

I haven’t used the solution architecture below but I can see they could be useful in the right scenario

Reusable Solutions (managed)

It’s a great idea to create focused managed solutions for reusable functionality.  Functionality like number sequence or a system configuration settings entity would be great to have as a reusable solution which could be used in many projects.

You might need to make functionality generic to fit into it’s own solution, untangling the dependencies from an existing project but the benefits will be you can slot the functionality into any project and potentially sell it to customers.


  • Small focused solutions, good programming practice
  • Reusuable solutions and functionality between projects


  • Maintain a separate solution
  • If solution needs to be different you need to branch the solution

Core Solution

If you have a CRM project which will be deployed to multiple CRM instances, it could be for different companies in the same group.  The companies could 50 percent of the same functionality and 50 percent different.  In this scenario you could have a core solution for the functionality which is the same and separate solutions for the organisation specific functionality.


  • Organises the solution logically and easily understood


  • Difficult to keep solutions from being dependent on each other
  • Lots of solutions to manage and support

System/Custom Solution

Two solutions, one containing system entities and another containing custom entities.  I’ve not seen a project use this but I have heard of someone else using it.


  • You can keep your custom entities and customisation separate from default entities


  • Is this needlessly complex

Futher reading on solution management

I have gone through my experience but I also found this white paper which discusses

ALM for Microsoft Dynamics CRM 2011: CRM Solution Lifecycle Management

Don’t be fooled by the CRM 2011, it is an in-depth analysis of CRM solutions and release management and it was updated in May 2013.

A summary of the white paper can be found here by Blake Scarlavai

CRM 2016 and patching

One of the traditional reasons for creating multiple solutions is large solutions would cause timeout errors when importing.  The easiest way to avoid time out problems is to split the solution into multiple smaller solutions.

Microsoft dynamics CRM 2016 include improvements with solutions, removing the need to add System entities and relationships as missing dependencies in a solution.  Microsoft added patch solutions, allowing you to import a smaller sub components.

Patches remove the need to create specific hotfix and version/sprint solutions because this is done using patch solutions at a more granular sub component/asset level.

Solutions organised  into entities and code (plugins/workflows etc) solutions, the benefit is an organisational benefit and ease of navigation.

How should we organise solutions

There is no one best practice for organising CRM solutions, solution architecture should be based on the requirements for the project.

I like the idea of creating small focused reusable solutions which you can use on various projects, a company could build up a collection of solutions to use in new projects, it would save time and create a standard approach to the functionality spanning projects.  This would help to answer the question Why isn’t code reused in Microsoft Dynamic CRM projects?

The solution design of a project rarely creates truly separate solutions and the solutions are dependent on each.  Having multiple solutions is a way of organising customisations to move customisations between CRM instances.

There are legitimate reasons for having multiple solutions which could be having a number of CRM instances which need a core solution.

The improvements in CRM 2016 and patching means the common problem of solution timeout isn’t an issue.


Considering the different options of which solutions you create, for general projects the advantages and disadvantages are similar.   There isn’t a definitive winner in terms of advantages but most companies will have a standard way of organizing solutions for general CRM projects (e.g. usually plugins, entities, reports).   Consistency will allow developers to work on different projects with least disruption

When assessing how you should organise your solution files you should consider the project, this should guide you to creating the best suited solution organisation for each CRM project.

If the project is before CRM 2016 patching solutions can’t be used, you will need to consider creating smaller solutions to avoid timeout problems.

To save time and efficiency, how you manage your solution is not as important as how you build and deploy those solutions.  In a large project with multiple environments a developer can spend hours manually deploying solutions through the various environments. 

The SolutionPackager allows you package solutions into XML Fragaments and linked with TFS to automate the build process.  This can be used with PackDeployer Automating the build and deployment process using CRM Package Deployer could save hours, reducing deployment errors.  The CRM PackageDeployer also packages data, to avoid the manual data deployments and guid problems.

CRM 2016 – XRMToolbox plugin store error – Unable to load one or more of the requested types

The XRMToolbox is awesome and now it has an auto updater, boom, saves me the bother of having to download and update etc.

I ran the auto updater and got this error when running the plugin store

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information

XRMToolbox error - unable to load one or more

I shut the plugin store and used the main XRMToolbox but I noticed some of the tools were missing such as

  • FetchXML Builder
  • View Designer
  • Export to Excel

To resolve this problem, I shut down the XRMToolbox and restarted it, the plugin store worked fine and all the plugins/tools were there