The Top 10 Hosk Dynamics CRM blog posts for 2016

Once you replace negative thoughts with positive ones, you’ll start having positive results. Willie Nelson

The company that needs Microsoft Dynamics CRM, and hasn’t bought it, is already paying for it #HoskWisdom

I have written Dynamics CRM blogs for 6 years and this year I got the most views in a year 673873,  beating last years numbers 661057.  Thanks to all the people who read my blog posts and support the Hosk Dynamics CRM blog post.

I have written blog posts so long the default category is CRM 2011!

A lot of people have told me this year how the Hosk Dynamics CRM blog post has helped them which is great.

Here is a list of the most viewed blog post in 2016 (I am always tempted to write CRM 2016, that will now stop with Dynamics 365).  The views don’t include articles viewed on other sites.

Home page / Archives 48326
CRM 2013 – Understanding Solutions and how they work 13408
Microsoft Dynamics CRM Developer Interview Questions 12904
CRM 2013 – Step by Step Update Plugin Tutorial using the CRM 2013 Development Toolkit 11382
What are the limitations of Microsoft Dynamics CRM Online and how do you work with them? 10162
CRM 2015/CRM2013 – JavaScipt to get the current users name 9753
CRM 2013 – Javascript to get id of current record 7370
CRM 2015 – how to find Statecode value 7141
MB2-703 – CRM 2013 Customization and Configuration Certification Information 7131
CRM Plugins – Stopping infinite loops and understanding PluginExecutionContext.Depth 7005
Where is the CRM Developer toolkit for CRM 2015? 7004

image from here

In Praise of the Incomplete Dynamics 365 consultant

If you’re not making mistakes, then you’re not doing anything. I’m positive that a doer makes mistakes. John Wooden

We are what we repeatedly do.  Excellencethen, is not an act, but a habit. Aristotle

During dynamics CRM projects there are many scenarios when something goes wrong.  Mistakes shouldn’t surprise us, CRM projects are complex, involving multiple people, processes and goals.

A project is organised chaos, setbacks and mistakes can lower affect the morale of the team but when mistake’s are opportunity to make strategic decisions to put the project back in the right direction, ensuring you are delivering the business goals

Don’t be surprised when mistakes happen during a Dynamics 365 project, be prepared #HoskWisdom 

Complexity 

In the excellent book The Mythical Man-month: Essays on Software Engineering Brooks challenges adding more people to a project to shorten time scales, highlighted by this quote

Adding manpower to a late software project makes it later.”
― Frederick P. Brooks Jr.Mythical Man-Month, The: Essays on Software Engineering

In the Mythical man-month Brooks discusses communication overhead, described here  Brooks Law

Communication overheads increase as the number of people increases. Due to combinatorial explosion, the number of different communication channels increases rapidly with the number of people. Everyone working on the same task needs to keep in sync, so as more people are added they spend more time trying to find out what everyone else is doing.”

Microsoft Dynamics 365 CRM projects meet project complexity overhead when a team works on different parts of a project becoming difficult to understand what other people are doing and how their information affects the CRM project.

The book The Checklist Manifesto: How to Get Things RightAtul Gawande examines complexity and knowledge.  A problem doctors face is not having the required knowledge to cure patients but understanding what treatment should be used among a list of possibilities.  The increase in medical understanding has doctors struggling to make the correct diagnoses in time.

“sometime over the last several decades—and its only over the last several decades—science has filled in enough knowledge to make ineptitude as much our struggle as ignorance.”

― Atul GawandeThe Checklist Manifesto: How to Get Things Right

Microsoft Dynamics 365 projects involve teams working on different partscollecting customers’ requirements and creating technical solution. The difficult to create CRM solutions aligned with business requirements, constraints and limitations required by the business, it’s a great breeding ground for mistakes and missteps.

Microsoft Dynamics 365 projects have many moving pieces with different directions and purposes.  You can’t focus on each piece because you need to understand the whole picture and overall strategy.  Dynamics 365 projects focus on many tasks and trying to understand the overall strategy can lead to mistakes because it‘s difficult to focus on many parts of a project with the same intensity.

Think like a datacentre

data center must not fail to keep within it‘s 99.9% uptime promise,  when failure occurs, it must recover because that what the customers pay for.

Microsoft Azure’s data centres need a strategy not to avoid hardware failure but to cope with hardware failure and not lose service.  Microsoft Azure allow you to choose different availability sets to reduce the likely hood of your servers being on the same rack, datacentre and country.

I’m not suggested you work on a project with the aim to fail but you should be prepared there will be mistakes and you must learn from them and not let mistake turn into failure.

Incomplete Leader

The article the In praise of the incomplete leader https://hbr.org/2007/02/in-praise-of-the-incomplete-leader inspired me to write a CRM version, the quote below gives a flavour.

It’s time to end the myth of the complete leader: the flawless person at the top who’s got it figured out. The sooner leaders stop trying to be all things to all peoplethe better off their organizations will be

The leader’s job is no longer to command and control but to cultivate and coördinate the actions of others at all levels of the organization. Only when leaders come to see themselves as incomplete—as having both strengths and weaknesses—will they be able to make up for their missing skills by relying on others.

Incompleteness and Dynamics 365 Professionals

Incompleteness is a fact of life in the Microsoft Dynamics CRM professional, we
  • Incomplete requirements
  • Incomplete solutions
  • incomplete code
  • Incomplete knowledge
  • Incorrect estimates
  • incomplete knowledge of the project due to communication overhead issues + time issues

Customers expect dynamics 365 consultants and developers to be experts Microsoft Dynamics 365, Dynamics 365 professionals expect customers to be experts in their business, capturing their requirements, limitations and complexities of their business.

There is too much to knowtoo many distractions, not enough time in an IT project.  During a project mistakes are likely, we can miss something, not collect all requirements and there is plenty of scope for misinterpreting the requirements.

We shouldn’t be surprised when things go wrong or off track because this happens with people, complex requirements, complex solutions.

Two things are important

  • communication
  • relationships

When you add the two factors together you get collaboration.  Collaboration is a vital ingredient to a successful project and if you have worked on an unsuccessful project, you will find problems in the relationship and communication which created an environment ineffectual collaboration

Internal collaboration

CRM professionals won’t know everything individually, to be effective you must use the experience, knowledge and ideas of your colleagues.  The size and breath of CRM and related services means no one CRM professional can have deep knowledge of all new CRM features and new products.

Group knowledge/experience is key to delivering projects which don’t implement customisation not suited to the business requirements or might cause problems later down the line.

One attribute of CRM professional is to know when to get help or delegate part of the project to someone who specialises in that area.

Four Capabilities

leadership as a set of four capabilities: sensemaking (understanding the context in which a company and its people operate), relating (building relationships within and across organizations), visioning(creating a compelling picture of the future), and inventing (developing new ways to achieve the vision).

Sensemaking

Business requirements must always drive solutions, if a CRM solution is not aligned to a customers business needs it won’t make a significant impact or deliver significant gains to the customer.  When gather requirements the key is to ask the right questions, to do this you have to understand the context of the company and how it operates.

Microsoft Dynamics CRM has generic functionality for sales, marketing, case management etc, most companies do not have generic requirements.  Companies want you to tailor the CRM solution to fit their individual way of working and their particularly business needs.

When gather requirements you must constantly relate them to the companies needs, goals to ensure you solution makes a business impact.

When demoing functionality the CRM professional must simplify the functionality to enable the user to understand what it does and how it works.  On the other side try to get the business users to simplify their requirements and remove any ambiguity.

Sometimes it‘s a case of the CRM professional keep working, understanding the business will help you understand the business requirements.  When you understand the reason behind a business requirement it‘s easier to understand and explain to other members of the team.

Relationships

A successful project builds on the foundation of a good working relationship between the users and the CRM professional.   During the project you spend time asking the team to do things for the project, the better your relationship the quicker and better the users will carry out those tasks.

The key to building a good relationship is to understand the users perspective and present information so they can understand it.  Encourage input and listen to their options.  Successfull projects are collaborations between the user (business knowledge) and the CRM team (technical CRM knowledge).  Unsuccessful projects occur is when one side is to dominate or doesn’t listen to the other sides opinion.

The article called the key point is you when you understand where the user is coming from you can relate to their business requirements and functionality needed.  CRM professionals will find customers can find it hard to relate to Microsoft Dynamics 365 functionality you should use the customers business language and terminology to help visualise the solution.

Solutioning

You gather requirements, user stories which you use to create a solution.  The features of the solution must be easily traced back to the business goals/objectives.  When creating a solution create a compelling vision of the future and sell this to the customer, they must believe this will make their working life better by helping them to their job more effectively.

When creating the solution get input from the business and technical experts with deep knowledge of Dynamics 365 functionality.  Feedback from business users and technical experts is vital at these stage, you must find flaws and problem areas.  A useful tool is a premortem where you predict the source of problems with the solution and investigate it.

The problems you find in the designing the solution are easier to fix before you started creating the solution.  Problems you find later means rewriting code or reworking a customisation as well as designing an alternative which fits the constraints of an existing solution.

Don’t let bugs get into production environments

Delivering

The customer needs to be prepared for the incomplete solution, it‘s this time when missed requirements, incomplete requirements and misunderstood requirements can distort the solution to not forefill the customers requirements.  Mmisaligned solutions are often assumptions not fully questioned.

A key part of delivering is to make sure the users get trained on the new system, customers can get frustrated and annoyed if they don’t understand how to use it.  The new system instead of helping them do their work, hinders the user because they can’t do something or it takes longer than the old familiar system.

Conclusion

Successfully delivering a project is an art not a science, you will make mistakes along the way.  A team delivers a project and the more people you have contributing the better it will be.

Projects must relate to the business goals, processes and the people who work there.  When project teams focus too much on technical solutions they can lose sight of the real purpose of the project and the CRM solution, help users archive business goals, which helps the business execute it‘s business strategy.

There are no secrets to success. It is the result of preparation, hard work, and learning from failure. Colin Powell

If someone does make a mistake, make sure they get given the Fail Fairy – The Fairy of failure – Who broke the build

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

https://msdn.microsoft.com/en-us/library/ms245046.aspx

 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.

Recommendations

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

How to evaluate job offers for Microsoft Dynamics CRM 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?

Moving

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
Consultant
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.

Salary

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.

Experience

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.

Culture

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

Location

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.

Structure

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.

Finally

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 developers tools of the trade – ReSharper

Do not wait; the time will never be ‘just right.’ Start where you stand, and work with whatever tools you may have at your command, and better tools will be found as you go along.

George Herbert

CRM Tools

Tools play an important part of the CRM developers life, they can save you hours of time and speed up development.  One of the best examples of a tool saving you time and effort is CRM MVP’s Scott Durow’s Ribbon workbench.  The manual process of editing the Ribbon in CRM is incredible tedious, the Ribbon workbench offers a GUI way to do it and it’s free.

Tools allow you to code on the shoulders of great CRM developers

You should checkout Tanguy’s XrmToolBox

I have reviewed a number of tools on this blogpost – Hosk’s CRM 2013 Tools List

Tools

CRM tools are very useful but there are some generic tools which are useful to CRM developers and one I would highly recommend is ReSharper by JetBrains.

ReSharper is a Visual Studio extension for .Net developers.  I have heard a few developers talk about ReSharper, so I thought I would have a look myself.  What you usually find is anyone who has used ReSharper will tell you how good it is.

The downside is this tool isn’t free but it doesn’t cost that much, find the price for personal use here

It is free for various people/groups which you might be part of

Additional options
* For startups (50 percent off)
* For students and teachers
* For education and training
* For Open Source projects
* For .NET user groups
* For Microsoft MVPs

For a personal license it’s 99 pounds.   Which if you use this a few times a week isn’t that much and the benefits to your coding and time spent finding bugs, formatting and other tasks could easily be worth it.  They also have a pay monthly option

ReSharper has a try before you buy scheme
The good news is you can try ReSharper free for the 30 days, so download it and give it a go.
I have tried it and I love it, to get the full benefits you will need to be writing CRM plugins and/or .NET code.
These blog posts highlight the benefits of ReSharper

Lots of features

ReSharper has lots of functionality, one of the difficulties I had was to learn what features were available, what they did and when I should use them.

These blogs were useful in learning about the ReSharper functionality

Warnings not nagging

I appreciate the way ReSharper works because it uses warnings.  These are often best practices but not serious.

It pops a warning mark on the right of the code and if you click on it you will get to a light-bulb.

Often I take these as suggestions, sometimes I do, sometimes I don’t. The way ReSharper warns you I have found not to be annoying or nagging.

Keeps me thinking

One of the positives of Resharper is keeps offering me code assistance and constantly keeps me thinking about the quality of code I’m writing.

  • It has offered to change a query expression to a linq query
  • swap If Else statements to a switch
  • Catching the nulls
  • One great features of Resharper is it warns you if a variable may contain null and offers to add an if statement to catch it.

Correct Naming standards

ReSharper is good for nudging you in the direction of better coding and will warn you to rename fields and functions

  • Lightbulbs – quick fixes
  • closing brackets and quotes automatically
  • Code Generation
  • Alt – INS

RED Errors whilst you type

“Big deal,” you may say. “Visual Studio already has squiggles like that.” True. But Visual Studio only shows the squiggles after you compile. ReSharper points out compiler errors in real-time, as you type. It does its magic completely in the background.

Grey is dead code

If you see grey code, it means you don’t need this code because it’s not being used.  Sometimes this is annoying because you are about to use it.  It’s good for getting rid namespaces you don’t need (ReSharper will get rid of them for you)

One feature I really like is when ReSharper puts up an error, there is an option to click which says

Why is ReSharper suggesting this and it will explain the coding practice to you

Auto Closing Delimiter

ReSharper automatically closes brackets

Not used warning

ReSharper has great features and one of them is to warn when variables are not used

I had an example where I was assigning a value and then overwriting it.  Resharper warned me that variable value wasn’t being used in any code branch

warnings I found annoying

VAR

One warning which annoyed me was Resharper trying to change all varibables to var to improve readability.  Personally I like developers to use the correct variable type and using var is a bit lazy.

it kept trying to persuade me to remove this but FXcop kept advising me to put this in.  Only one way to resolve this

FIGHHHTTT

The good news is it’s easy to turn off the warnings.  You can turn off the warnings in a method or class or project.

Or you can turn the inspect severity and then search for the error you want to remove.

Learn to use your tools effectively

Tools can make speed up development process and make development processes easier. Choosing the right tools is one part of the solution.  The rationale behind this is you probably use your development tools on a daily basis, if you can find functionality which speeds up, automatics tasks you do every day, lots of times a day you will make a considerable time saving.

This sums up my thoughts on resharper, it eases and speeds up my development

information for learning ReSharper

There is a series of screencasts on the Dime Casts website which are quite good as an introduction.There is also the 31 days of Resharper and the official demos give you an idea of what’s possible so you know to dive into the menu.
This article show you how ReSharper’s code creation

Absence makes the heart grow fonder

The time I really notice the work ReSharper does is when I am helping with someone and they don’t have ReSharper.

ReSharper helps refactoring, this article describes why – Why use ReSharper manage refactor code

Overall

ReSharper makes working easier and smoother with lots of great enhancements.

Warning me about unusual variables, methods and usings is useful.

Warnings about code which could be done better is useful

It’s difficult to describe what exactly ReSharper does but it does things better than Visual Studios’s out the box functionality and will make your life easier.  If you use Visual Studio on a daily basis all the small benefits will add up to large benefits.

If you try ReSharper you will see why it’s great and will be tempted to buy it

Questions on Microsoft Dynamics CRM solutions and environments

The art and science of asking questions is the source of all knowledge.

Thomas Berger

I was asked some questions about solutions in Microsoft Dynamics CRM, I decided to answer using a blog post so other CRM developers could benefit.  If one person is asking the question there are probably many more people thinking it.

Posting the answer to a question on my blog means other people who are having the same problem can find the answer.

Solutions

Understanding solutions is a something a CRM developer must master,  getting it wrong can cause problems deploying and managing your customizations.

The blogs below will give you a good understanding of Solutions, how they work and many of the common problems you experience with solutions (usually managed solutions)

Here are the questions

Q.  All changes made to any (unmanaged) solution are applied to the default solution.

A.  All changes to an unmanaged solution are applied to the default solutio,  you can’t undo the changes except by importing an older unmanaged solution, which is like rolling back those customizations.

Importing an unmanaged solution will overwrite any of the customizations included in the unmanaged solution (assuming the system only includes unmanaged solutions)

Q.  Multiple developers are able to work in parallel on the same entities as all changes are applied to the default solution. Everyone has sight of all changes at all times.

A.  If you are working on the same CRM environment, changes  will be visible instantly to all developers but only published changes will be visible to customers.

  • Fields, views, new entities will be visible instantly
  • Form changes will be visible when the developer publishes the solution

Code changes are different due to the way CRM developers work e.g. CRM developers tend to download a copy of the code (Javascript or plugin) work on the code and then upload when ready.

Developers usually get the latest code from TFS or the source control used in the project rather than getting the latest code Javascript from the CRM form.  This process can result in developers overwriting changes if they are both working on the same Javascript or plugin at the same time because they work offline whilst coding.  You can work around this by setting up processes and source control is your friend.

This blog post discuses multiple developers working on web resources

How do multiple developers work on a web resource within the CRM environment

Q.  Removing the unmanaged solution does not remove the changes in the default solution – these have to be removed manually (or the default solution can be restored (snapshot tools like Cobalt look good and free? Can they be used to perform a rollback in Dynamics online?)

A unmanaged solution is a wrapper to move your customization’s between CRM environments.  When imported it imports those changes into the default solution, overwriting any existing changes.  Deleting the unmanaged solution will delete the solution but not delete the customizations.

Managed solutions can be thought of as read only to the customer.  You cannot modify any of the managed components (unless they are the default CRM fields).  Deleting a managed solution will delete the customizations and the data.

To remove unmanaged customizations you must delete them manually.  Solutions are additive which means they don’t remove customizations.  You can use unmanaged solutions to change the customizations back to previous state.

I haven’t used Dynamics CRM Snapshot from Cobalt but looking at the page it seems to snapshot the data not the solution and customizations

You can create snapshots of your customizations by keeping the solution files so you can import them to roll them back.  Remember to use version numbers otherwise it’s difficult to manage and keep track of the CRM solutions, particularly if you have to move the solutions through multiple CRM environments.

Version numbers are mentioned in the blog post CRM 2015 – Best practices for CRM Deployments

Q.  Managed solutions are essentially a container for any changes you want to move to a new environment. Care must be taken to ensure that all of the relevant changes to entities are pulled into a release. It will become clear when the solution enters UAT if dependencies have been missed.

I have written about Managed solutions CRM 2013 – Managed solution problems with out of sync solutions.   Only a solution from the same publisher can update the customizations in a managed solution

Why use managed solutions

Choosing your solution strategy is an important because it can be difficult to swap back from a managed solution to an unmanaged solution.  There is anxiety before you make the decision and push the button and import a managed solution.

There are many choices you have to make in CRM which are very hard to undo like

CRM Entity ownership – How do you decide?

I have talked to CRM developers who hate managed solutions and only deploy unmanaged solutions. I have been asked numerous times why anyone would use a managed solution, so lets investigate the reasons.

The logic behind a managed solution is two fold

  1. Managed solutions are read only to protect the customization creator from users and CRM developers taking and changing the customizations
  2. Stopping users from changing the customizations which could result in the customizations not working or working incorrectly.

Managed solutions are great for CRM resellers who created a solution for CRM which acts like a products.  E.g. an Autonumber solution.  They can sell the Autonumber solution, it’s gets deployed and the users can’t change any of the code to stop it working and other CRM developers can look at the code to steal the code/ideas.

This scenario is ideal for managed solutions because if the users change their mind and don’t want to use the solution they can uninstall it and it removes all traces of the solution and its data.

Q.  If managed solutions are removed from an environment any data would be removed as well – so we should NEVER remove a managed solution but instead apply a new managed solution on top.

When you remove a managed solution it removes everything

  • Customizations
  • Data

Once the data is gone you can’t get that back, which is why you need to think carefully if using managed solutions are the right choice.

I know many CRM developers who refuse to use managed solutions due to

  • Build problems
  • unable to edit production/live system without importing a new solution
  • Solution dependencies

Unmanaged solutions will give you an easier life but it will potentially let end user modify live customizations which could break the solution and with no easy way to know what had been changed.

CRM 2016 has added patched solutions

Solution patching allows you to release smaller solutions, creating smaller solutions and reducing conflicts and problems when deploying the patch solution.

I haven’t used patch solutions so I don’t know if the theory works in practice.

Q.  Environments setup question

Dev – unmanaged default solution with project related solutions.
UAT – Test environment that managed solutions are deployed into.
Live – managed solutions transition to prod when successfully passed UAT.

There is no right answer for the number of environments, it depends on the development and testing schedules you are doing, how you work with the customer.

The number of environments can reflect the different phases of a project,  you can often have testing and development phases running at the same time.

Ask yourself what is the purpose of each environment.

I would add a preproduction environment, an environment which is hosted on the customers site or a sandbox instance if using Microsoft Dynamics CRM online.  This environment has exactly the same customizations and similar data to the production environment.  It allows the customer to test near production environment and is useful for investigating live issues.

For on premise development it’s common to have a development environment and internal QA/UAT environment for non developers to test fixes.  Developers are terrible at testing their own fixes

The usually test as CRM Admin role – The System Administrator role is a benefit and a curse to CRM developers

They often only test the happy path –Don’t just test the happy path

Development environments have development data – How to create realistic Test Data for your CRM Project and why you should

Here is some final reading on CRM environments for you – The pain of setting up CRM Dev environments

Why isn’t code reused in Microsoft Dynamic CRM projects?

Microsoft Dynamic CRM code and customizations are rarely reused between projects and few companies create solutions to share between projects. This means CRM companies need to rewrite the same code again for each project but is there an alternative method.

CRM projects focus on delivering solutions but don’t to reuse solution and code.  In many companies CRM developers can create different versions of the same solution.

When developers work on projects they are focused on delivering a solution to meet the customers requirements.  If time the developer will

  • Improve code design
  • Refactor code
  • Reduce technical debt
  • Unit test code
  • Update documentation

The tasks mentioned focus on long term benefits and the reason they are often omitted.  Improving code design and refactoring make code easy to understand, extend, debug and maintain, these steps are unnecessary but make a huge different in maintaining the code.

The difference between good and average CRM developers can’t be seen in functionality delivered to the customer because they will be the same.

This posts

Why your CRM code and customizations should be simple

The problems with complex code and complex CRM Customizations

It’s difficult to simply code, refactor and improve the design, a reason average developers omit those steps.  Explained beautifull by Martin Fowler

“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.

Martin Fowler

Simple code reduces time spent debugging, maintaining, understanding and interacting with the code e.g. further phases of development.  This explains why failures in CRM projects often occur after the first release of a CRM solution when the CRM developers struggle with a messy solution.

Other signs you CRM project is doomed can be found in this article 13 signs your CRM project is doomed

I have worked on a project where a plugin had a method which was over 1000 lines long.  This method became a bottleneck in the project because developers struggled to understand what it did or how it worked.  Small changes took hours whilst developers tried to understand the code, work out where to put their fix and testing the fix hadn’t broken existing code was impossible because the code was to complex to unit test.

Custom code

Most CRM projects will have custom entities which exist only in the individual project to either make the customers business processes or needed to deliver the required functionality.

Writing bespoke projects often preclude the project code and customizations being reused because the customers requirements are not needed in other projects.

CRM developers who don’t use solid principles to reduce coupling in their code are unlikely to be able to reuse code.

Code cannot always be be reused because of unique requirements, most of the time CRM developers don’t think about reusing the code or writing it to enable reuse.

New project, new code

Before software can be reusable it first has to be usable.”
– Ralph Johnson (computer scientist)

Reusing code is a great, you can add code which has already been written and tested.  It takes more effort to write reusable code, to write code in a generic way ensuring there are no dependencies on the current project.

Developers are not rewarded for code reuse or encouraged to write reusable code and customization’s by their employers.  Without motivation or reward why would developers go to the extra effort of writing code which benefits developers/company in the long term?

To write of reusable code you need skilled developers, sometimes called craftsman.  Highly skilled developers, take pride in their work and consider long-term implications of their code and who look to reuse code.

Most CRM projects are run with short-term goals in mind, answer these questions about Microsoft Dynamics CRM projects you have worked on?

  • How often do CRM developers reuse code from earlier projects?
  • Do CRM developers know what earlier projects did to understand if any of the code or customizations could be reused?
  • How many projects is the code good enough to be reused?
  • Does anyone look at previous projects to see if they could create a generic reusable project?

Companies don’t reuse code or catalog CRM projects.  CRM professions and CRM developers move companies often, most existing and new developers didn’t work on earlier projects and are ignorant of them.

Interaction with historic projects usually occurs when a bug is raised or through a change request.  If you are unluckily enough to be dragged into an old project, they are legacy projects with code and customizations arranged in a baffling structure taking days to decipher even the simplest of bugs.

Is there another way?

Wouldn’t it be great if new CRM projects were created by plugging together small separate solutions.  It would be quicker to create solutions like this and the code would have already been tested.

CRM developers could look at old projects for common functionality that could be reused in different projects.

Identifying functionality which could converted into a generic reusable solutionIf the solution was useful it could be sold but at a least it could speed up development on new projects needing that functionality.

This would involve taking a long term view of CRM development and ensuring their CRM developers are writing quality code and customizations.

Why doesn’t code get reused

Code reuse has many advantages but I haven’t seen any examples of code reuse in the projects I have worked on. I have listed some potential reasons for this below

Developers

A lot of developers don’t love writing code and to them it’s just a job, this shows in the quality of their code.  They are not passionate about it and certainly wouldn’t classify themselves as craftsman.  I don’t enjoy decorating, I take shortcuts and aim to paint a room as fast as possible.  The lack of enthusiasm and passion for decorating the room, shows in the finished product, I spot bits I missed and drip marks.

The same result can happens with the code of people who don’t enjoy developing,

To write simple code you will have need to want to improve, the best way is to have a mentor but you can get a paper/electronic mentor by reading classic books on programming or have a mentor to teach you.  I recommend

CRM companies have s high churn rate, offering small payment increases to staff based on their current salary.  LinkedIn pressures this model with recruitment agencies offering CRM professionals the current market rate for their skills and experience, more than the current salary plus inflation.

The regular movement of CRM developers leads to a lack of long term thinking and planning.  Why write code with long term benefit if you are not going to be there to gain from it.

Development standards and way of working need a consistent workforce to implement and developers adhere to them.

Project view

CRM solution providers organise effort at a project level, gearing everything around projects.   The approach is understandable because customers pay for projects and effort is focused on money.

Creating reusable code and solutions is an activity which needs to be done around or outside of delivering a project.  It may involve going back and identifying reusable/generic solutions or taking a little bit longer to write reusable code.

Maturity of Microsoft Dynamics CRM

I’m not sure about this but I wonder if creating reusable code/solutions is something which will occur with maturity of companies and developers.

Will companies get tired of recreating everything on each project?

Versions

Microsoft Dynamics CRM currently has a major release every year, this adds a significant challenge to creating reusable solutions and code.

A solution created today could become standard functionality in the next release of Microsoft Dynamics CRM or your solution might not work, with a need to upgrade the solution to be compatible with the new versions of Microsoft Dynamics CRM.

Microsoft Dynamics CRM online is increasing in popularity, CRM online projects use a different architecture than CRM on premise.  This provides a barrier to reusable CRM on premise solutions because those solutions won’t work with the limitations of CRM online.

The long term view I have is CRM providers will create micro services in azure which will integrate with CRM online services, this architecture allows one service to be used on many CRM Online projects.  This architecture model is being used by FieldOne and their autorouting service, which is hosted in Azure.

Size of CRM companies

Small CRM solution providers whose model doesn’t afford to spend time on non project work.  Bigger companies should have an advantage over smaller companies by creating resusable code and solutions but I’m not sure many larger CRM companies do this at the moment.

Summary

It’s easy to point out the problem of lack of code reuse, it’s harder to pinpoint the steps to overcome this.

The CRM project mentality creates project focused code, not reusable or often known about by other developers in a company.