The Dynamics SDK is the main tool for a Dynamics developer, the better a developer knows its capabilities, limitations and documentation the more efficiently they can create code.
Dynamics developers should start with the SDK/Web API, it contains all the functionality needed to work with Dynamics, yet many developers rarely look for clarification/help usually turn to the internet to search for examples and code. Retrieving code examples results in a missed opportunity to learn.
What is the Dynamics SDK/Web API?
Start learning about the Dynamics 365 SDK here — Get started with the SDK for Dynamics 365 Customer Engagement (on-premises).
To use the Web API make sure you use the common data service found here
The SDK is the main tool to work with Dynamics via code on premise and the Web API for OData queries online, the better a developer knows its capabilities, limitations and documentation the more efficiently they can do their job.
You can learn a lot from reading, understanding and running the code samples. Sample code directory for Dynamics 365 Customer Engagement (on-premises)
What is the in SDK?
The SDK is a link to a number of dll’s or links to nuget packages.
There is a link to more details on Microsoft document here
The main assemblies
The DLL’s are methods you can call to interact with Dynamics programmatically and do other activities such as DevOps — publish solutions etc.
The SDK downloads the dll’s and the Web API lets you call those methods using OData queries.
For Web API start here
When I mention the CRM SDK, I am talking about primarily about documentation which describes the functionality contained in SDK or Web API.
Look here to find out what it can do
This is my Dynamics SDK/Web API
In the film Full Metal Jacket Gunnery Sergeant Hartman tells the recruits to give their rifles a name because it’s their best friend and could save their life (he actually says give the rifles a ladies name because they won’t be getting their hands on any ladies for a long time).
Dynamics developers should view the SDK/Web API as their development rifle. It’s your best friend and your main tool in development and it will save you development life on numerous occasions with the it’s functionality and features.
Gunnery Sergeant Hartman: Pray!
Recruits: [chanting] This is my rifle. There are many others like it, but this one is mine. My rifle is my best friend. It is my life. I must master it as I must master my life. Without me, my rifle is useless. Without my rifle, I am useless. I must fire my rifle true. I must shoot straighter than my enemy, who is trying to kill me. I must shoot him before he shoots me. I will. Before God I swear this creed: my rifle and myself are defenders of my country, we are the masters of our enemy, we are the saviors of my life. So be it, until there is no enemy, but peace. Amen.
Most Dynamics developers aren’t allowed guns at work because in times of frustration it would be too tempting to shoot their computer but each CRM developer will have his own copy of the CRM SDK (for each version of CRM). I have adapted the quote to make it more suitable for CRM development
Dynamics developers: [chanting]
This is my Dynamics SDK. There are many others like it, but this one is mine. My Dynamics SDK is my best friend. It is my life. I must master it as I must master my life. Without me, my Dynamics SDK is useless. Without my Dynamics SDK , I am useless. I must development with my Dynamics SDK true. I will.
Before Hosk I swear this creed: my Dynamics SDK and myself are defenders of my Dynamics Solution, we are the masters of the Dynamics Solution, we are the saviours the Dynamics Solution. So be it, until there is are no bugs, but peace in Dynamics dev land. Amen.
Development is like a jigsaw puzzle
I view development as a jigsaw puzzle, like a jigsaw puzzle development contains many different but connected pieces.
Learning and understanding the different pieces often helps see how the other pieces of the jigsaw fit together.
A couple of examples could be
- Learning about plugin architecture can help understand how workflows, real time workflows work and why plugins are quicker.
Learning new skills is a mix of theoretical (reading, videos, etc) and practical (doing). There is a different between theoretical knowledge and practical knowledge, which occurs when you try to get the sample code to run and have to fix many small problems before it works. Whilst fixing these problems you learn how things really work.
Theoretical knowledge without practical experience has a limited value because until you write some code or create a customization you can’t be really sure you know how to do it.
Practical knowledge without theoretical knowledge is more useful but this can be a slow way to learn, involving making lots of mistakes and learning best practices through action. Problems and errors can be harder to diagnose and fix if you lack the theoretical knowledge and understanding of how the SDK works.
The above section is the long way of saying CRM developers should read the CRM SDK documentation.
Developers and the Dynamics SDK/Web API
The SDK/Web API is the supported/safe way to interact with the Microsoft Dynamics database. Just like an annoying family member you are stuck with it and every day you come to work you are going to have to work with CRM SDK/Web API.
The SDK/Web API can be stubborn, difficult and renowned for not suffering fools gladly
The Dynamics SDK/Web API is a cruel mistress to those who do not show it respect but if you play nicely, tickle CRM SDK’s belly it will deliver untold development riches
You cannot work around the CRM SDK/Web API
My advice to developers who are thinking about creating unsupported customizations is don’t even think about it.
If you put unsupported customizations into your solution Microsoft will not support your Solution.
Do you want to the person who has to inform the customer you cannot get support for your problem (which could be a bug in Microsoft Dynamics 365) because you wrote an unsupported customization.
There are other reasons why you should put unsupported customizations in
- Upgrading will be harder
- Unsupported customizations could stop working with any update
- Microsoft won’t support the Solution
How some Dynamics developers work
Most developers when faced with a task they are not sure about will look for some sample code to use. The common places to get some code are
- Internet search
- Hosk’s Blog :-)
- Existing code
- Ask a question on the forums
- Ask a fellow developer how to do it
- Look at the SDK/Web API
Most developers view development
Learning through experience is a valid way to learn but it can be a slow, where the developer has to make the mistakes themselves and learn from them. Reading the SDK/Web API can help speed up the learning process because you understand how it works and avoid some of the errors/mistakes.
It’s vital to know the limitations of the functionality to avoid it causing problems when you find out later a certain piece of functionality can’t be used.
- Plugins have a 2 minute time out, if you have some long running C# code then this needs to be done as a custom workflow.
- Rollup fields cannot reference other rollup fields.
- Workflows are Asynchronous, if you need the customization to run synchronously you need a real time workflow or a plugin.
Strive to understand how CRM SDK/Web API works
I encourage Dynamics developers to start with the CRM SDK/Web API and see what functionality is available and to increase your understanding of how the CRM SDK works.
Getting code examples is great but it bypasses the learning involved in creating the code yourself.
All craftsman should know their tools, a Dynamics developers main tool is the SDK/Web API. Know it forwards, backwards, upwards, downwards and inside out. A CRM Developer should know the CRM SDK better than members of his family
You can view the CRM SDK as a family member
- It’s troublesome
- Can be extremely annoying at times
- CRM SDK can bring you great joy
- You have no option (supported option) but to get on with it
- It’s constantly changing and evolving
- It can be difficult to understand what it’s saying (confusing error messages!)
- You love it
Why should you learn how it works
The better you understand the Dynamics SDK/Web API and Dynamics functionality the more in depth your understanding will be of the different customizations available.
Error messages don’t tell you the problem but often point you in the right direction — Dynamics 365 error messages point you in the right direction. If you have studied the SDK/Web API it makes sense.
In my blog post How to diagnose plugin errors in Dynamics 365 it details plugin errors and how knowledge helps when things go wrong
Dynamics 365 is constantly evolving and functionality will be added and depreciated. The best way to stay up to date is read the What’s new. Why you should read the What’s new for developers
My aim each day is to know more about Dynamics development when I leave work than when I started it.
picture from here