Understanding StateCode, StatusCode, Status and Status Reason in Dynamics 365

Leave a comment

In Dynamics 365, entities contain the fields StateCode and StatusCode. If we create a new entity, we can see the statecode (display name Status) and statuscode (display name Status Reason) fields are automatically created:

We can also see the types of these fields are Status and Status Reason respectively.

Let’s look at the Status field. We can see it is of type Status, but we do not see any values associated with it:

The Status Reason is of type Status Reason and has one value called Active:

We can rename and delete Active if we want to:

We can also add our own values:

If we look in Advanced Find at our new entity and filter on Status, we can see there are 2 options – Active and Inactive:

With Status Reason, we get Active, Inactive and In Progress (the new one we added):

The Status Reason is a special field, in that in the toolbar we see Edit Status Reason Transitions:

You can read more about those on my post here.

Let’s look at other entities in the system. First, Accounts. This has 2 states, Active and Inactive:

And 2 status reasons:

For Opportunities, status is Won, Lost, Open:

And Status Reason has several options (Accepted, Canceled etc):

The Opportunity Status contains the data type:

And Status Reasons we can create/edit/delete:

Note if we look for statecode or statuscode in global option sets, we will not see it:

To get these option set labels, we can use the Web API and access EntityDefinitions.

For state:


Here we can see Won, Lost, Open states:

For status:


Here we can see the Open for Bidding label in the query:



Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube


Leave a Reply

Your email address will not be published. Required fields are marked *