Set State Error : “Entity: … does not have valid status code”

I was writing a very simple CRM plugin that needed to deactivate a few records given a specific context. Every time the plugin was firing, I was getting the following error message:

“ Entity: askpam_proposal does not have valid status code ”


In my process, I was trying to update the status and state of an entity record of type “Proposal” to go from “Active –> Proposed” to “Inactive –> Not Validated.” In Theory, there is nothing wrong with it but for some reason, this was not working. After a bit of research, I realized my colleague had previously configured some Status Reason Transitions for the Proposal entity as follows:


As you can see there, it is not allowed for the Status Reason to go from Proposed to Not Validated. That was causing the error to occur. If you ever see this error message “Entity: _your_entity_name_ does not have valid status code,” make sure your Status Reason Transitions are configured to allow for whatever transition you are going through.

Hope this helps.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s