# Entity Status: statecode and statuscode

Many entities have a statecode field that controls the state the entity is in.

For example, the phonecall entity has a statecode field that may be Open, Completed, or Canceled. When the phone call is in the Open state, it is shown in the Activities list; when it is Completed or Canceled, it is shown in the History list.

The contents of the statecode field are not normally shown in the user interface in Dynamics CRM; instead, the statuscode field is shown.

The statuscode field holds the reason the entity is in a given state. There may be more than one status value for any state value; see for example the following table for the phonecall state and status.

statecode | statuscode
--- | ---
0 | Open | 1 | Open
1 | Complete | 2 | Made
|  | 4 | Received
2 | Canceled | 3 | Canceled

It is not possible to set the statecode value when creating or updating entities; it is a read only field.

Inaport allows you to map to the statuscode field; this will cause the entity to be assigned the correct state based on the status you map. You can map:

- the text value of the status: "Made", or
- the number value of the status: 2

For example, if you map "Made" or the number 2 to the statuscode field for a phonecall, the state will be set to "Complete".

The statecode is not customizable in Dynamics CRM, but the statuscode field is; you may add more status values for any state. Inaportwill recognize any custom values you have assigned and treat them correctly.

To check the available status values for any entity, have a look at the statuscode field in Customizations in Dynamics CRM.