Dynamics 365 error messages point you in the right direction

“If your mind is empty, it is always ready for anything, it is open to everything. In the beginner’s mind there are many possibilities, but in the expert’s mind there are few. ”
Dynamics 365 error messages point you into the right direction but never give you the answer #HoskCodeWisdom

A developer was working on a Dynamics 365 form, it was generating an error saying the contex was null when you deleted a value from a field. The developer was investigating the problem by trying the different routes through the code by changing values on the form, sometimes it errored and other times it worked.

The developer felt frustrated because they had copied the code from another area and it worked there

The error was something like –  Unable to get property “getAttribute” of undefined or null reference 

The error was occurring in a function which passed the context into the function, read about the

The developer had copied, pasted and adjusted the code, he was focusing on comparing both and was so focused on fixing a problem he was ignoring the error message.

Copy, paste and adjust are not a replacement for thinking

When developers copy, paste and adjust code they miss out the learning and experience which comes from creating.  The time you improve as a developer is in the journey of creating code, fixing bugs.  There is no shortcut to putting in the hard work and learning and understanding.

If you bypass the learning part, you end up with something which works or does not work but you don’t understand why.

Dynamics 365 developers need to learn how the Microsoft Dynamics 365 SDK works, the better you understand how the CRM SDK works it is easier to diagnose problems.

I recommend to Always start with the Dynamics 365 SDK

Dynamics 365 errors point you in the right direction

To diagnose an error, you must look at the error with an empty mind #HoskCodeWisdom

Dynamics 365 error messages point you into the right direction but never give you the answer.  Often developers are so busy trying to solve the error they don’t stop to think what the error message is telling them.

In this example the developer forgot to pass the context into the function by ticking the checkbox on the OnChange trigger.

Don’t assume, know

Developers rush to solve bugs, need to slow down, consider what they know and what they are assuming is happen.  One definitive method of investigating a bug is to debug the code, identify and path the code is taking.

An example of bug investigation and how to approach fixing bugs

Sherlock Hosk and the case of the annoying bug

Approach bugs with an empty mind and don’t assume what is happening but prove what is happening.

For example –How to diagnose plugin errors, it has a good section on plugin error messages

Plugin Error Messages

The error messages Microsoft Dynamics CRM throws are a mixture of a confusing statement with a nugget of truth tucked inside.  To developers new to CRM development they are unhelpful messages.

As experience and knowledge of CRM development increases you will find they often point you in the right direction but need to build up a map of the CRM landscape, so you know where to go and check.

Enjoy your bugs

“enjoy your problems” ― Shunryu Suzuki

Developers should enjoy their bugs because their offer a path to increase knowledge and understanding #HoskCodeWisdom

Bugs and errors offer a trigger to learn more Dynamics 365 and programming, allowing you to learn why something isn’t working, you can invert the logic to understand why and how code should work.

The more time you invest in learning Dynamics 365 and development the better prepared you will be to identify the cause of problems and bugs.

Dynamics 365 development is understanding the limitations of the different customisations and services available to Dynamics 365, when and when not to use them.

An example was someone had done 1 months work creating a solution using Click Dimensions only to find the solution didn’t work because Click Dimensions couldnt use optionsets with over 50 options.

Choosing the most right customisation requires the developer to have an in-depth knowledge of Dynamics 365 and there are no shortcuts in becoming a good Dynamics 365 developer.

Other articles on Developer testing and errors

Advertisement

One thought on “Dynamics 365 error messages point you in the right direction

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.