With the release of Microsoft Dynamics CRM 2013 SP1 and Microsoft Dynamics CRM Online Spring ’14 a range of new features have been provided. One of these is Status Reason Transitions. Status Reason Transitions allow the Status Reasons for an Entity to be configured so that Users are permitted to change the Status Reason of a record from the current Status Reason to a new Status Reason based on the permissible Status Reason Transitions configured for the Entity.
The following diagram shows the Status Reasons that a Product is permitted to progress through as part of a custom Approval, Publishing and Expiry Business Process; (Do not confuse Business Process here with Business Process Flow):
• Products have a default Status Reason of Awaiting Review.
• Awaiting Review Products may be transitioned to Approved, Declined, Deleted (archived) or Published.
• Approved Products may be transitioned to Published.
• Declined Products may be transitioned to Awaiting Review
• Published Products may be transitioned to Updated or Expired.
• Updated Products may be transitioned to Published.
• Deleted (archived) and Expired Products cannot be transitioned to another Status Reason.
• The Status Reasons in green represent Active Statuses and the Status Reasons in grey represent Inactive Statuses.
This sequence of permitted Status Reason Transitions are configured using the Edit Status Reason Transitions button on the toolbar when customising the Status Reason field on the Entity as shown in the following two screenshots:
There is an Enable Status Reason Transitions option:
Once these Status Reason Transactions are configured and enabled, Users will only see new Status Reasons based on the current Status Reason and the configured Status Reason Transitions. The following screenshots show how this works from the Users perspective. These include some variations in what the User sees or has to do in order to transition between Active and Inactive Status related Status Reasons.
• When the Product is Awaiting Review the Status Reason may be transitioned to Approved or Declined:
• When the Product is Declined the Status Reason may be transitioned to Awaiting Review:
• When the Product is Published the Status Reason may be transitioned to Published:
• When the Product is Published it must be Deactivated in order to transition to Updated or Expired because the Updated or Expired Status Reasons are Inactive Statuses.
• If there is more than one possible Inactive Status Reason that the Product could be transitioned to, such as Updated and Expired, then the following prompt will be displayed listing these for the User to select from:
• When the Product is Updated it is only possible to transition it to Published by Activating it. Because there is only one Active Status, i.e. Published, that the Product could be transitioned to, it will be automatically transitioned to Published when Activated.
• If there is more than one possible Active Status Reason that the Product could be transitioned to, such as either Awaiting Review and Published, then the following prompt will be displayed listing these for the User to select from:
• Once a Product is Deleted or Expired, however it cannot be transitioned to another Status Reason. If the User attempts to Activate a Deleted or Expired Product the following message is displayed:
These Status Reason Transitions are not enforced when updating the Product by exporting, updating and then reimporting from Microsoft Excel as shown in the following screenshots:
Using a Real-Time Workflow Process to change the Status Reason to Published for a Product whose Status Reason was Awaiting Review does result in a Business Process Error being displayed as shown in the following screenshot:
For the purpose of this blog I simply tested using export, update and import from Microsoft Excel and using Change Status in a Workflow Process.
According to the Microsoft Dynamics CRM 2013 SDK: “When this data is present [i.e. Status Reason Transitions] and the Entity EnforceStateTransitions property is true, any … instance can only be changed to one of the allowed statuscode values. You can use IOrganizationService.Update to set the statuscodeOptionSetValue to any of the allowed values that don’t represent a change in state. To change the state, use SetStateRequest setting the allowed State and Status property values … to one of the values allowed for the current statuscode value. Attempting to set an invalid value throws an error.”
In conclusion, Status Reason Transitions is a great new feature introduced with the latest update of Microsoft Dynamics CRM, but it does need to be understood prior to using it.