Prior to Microsoft Dynamics CRM 2015 (update 1) we had to use special messages when updating special fields. Those special fields include the record’s status (statecode, statuscode), the owner of the record (ownerid), etc. The full list of those special messages can be found on msdn, here.

Now since those special messages are deprecated we can now (and should) utilize the regular update statement.

Instead of (deprecated, do not use!):

We can now simply use:

Much better!

Just make sure the combination of status reason (statuscode) and status (statecode) is a valid combination or it will throw an exception. You can verify the configured combinations (and their optionset value) in your solution when navigation to the statuscode field:

Example status & status reason combinations

One thought on “Update status (statecode & statuscode) of a CRM record using C#”

Leave a Reply