The views and opinions expressed in this blog are those solely of the author(s) and do not necessarily reflect Microsoft’s current policy, position, or branding. For official announcements and guidance on Dynamics 365 apps and services, please visit the Microsoft Dynamics 365 Blog.
Personalized Community is here!
Quickly customize your community to find the content you seek.
Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2020 release wave 1Discover the latest updates and new features to Dynamics 365 planned through September 2020
Release overview guides and videos Release Plan | Preview 2020 Release Wave 1 TimelineWatch the 2020 Release Wave 1 virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
Someone asked me how to find the StateCode value on a custom entity today, so the first thing I did was to search the Hosk CRM Blog.
A lot of people get confused between Status Reason and State code, if you do then read this blog post
CRM 2013 – Understanding Status and Status Reason – think before deleting them
Status and Status reason are both optionsets. Option set have an int value and a text value. The text value is meta data and the int value is held in the database on the database field.
Default entities have two status values
Status reason have different default values
The key piece of information is State and Status Reason have different values and this can be confusing, usually it goes down the lines of
I know State or Status Reason Active = 0 but which one is it.
A quick way to confirm what the Status or Status reason is, is to do an advanced find and use Status or Status Reason in a conditional. If you then click the download Fetch XML button you can see the values being used
Magic numbers in development is when developers use number values for status or any option sets but give no indication what the values mean. This makes reading/understanding the code difficult and extremely frustrating because you often have to go and look up the values.
Wiki gives a good description of Magic numbers in code
here is a good explanation on stackoverflow – What is a magic number, and why is it bad?
Below you can see an example of magic number being used in code, what status is number 6! If you are lucky the developer will add a comment
//do something incident cancelled
//do something incident cancelled
Don’t be lazy, create the Option Set enums and make your CRM code more readable. I have written a blog on why you should create Enumerations for optionsets.
CRM 2013 – Create Enumerations for option sets
There is a great tool to help you called
CRM Early Bound Generator
I reviewed the tool in the link belowCRM 2013 Tool – CRM Early Bound Generator
Business Applications communities