Fixed – Unable to Create or Update record after Upgrading Dynamics 365 CRM

By | February 28, 2018

Introduction:

Whenever we upgrade Dynamics CRM we learn many things along with it. Recently we had a business requirement where we recently upgraded Dynamics CRM from CRM 2011 to CRM 2016. We completed upgrade smoothly but after upgrading to CRM 2016 we were not able to Create/Update the Service Activity record. While saving the record we were facing the below error popup message.

Unable to Create or Update record after Upgrading Dynamics 365 CRM

After downloading Error Log File, we found below error message.

<Message> Both statecode and statuscode must be set or both of them must be null. </Message>

The error messages show that Statecode and StatusCode fields must be filled or set NULL. But more often, we are not setting any values and as we know, CRM internal program sets the default value for these fields.

So, we plotted this issue and found the root cause, .i.e. the “statecode” field was entered in the form that was in the editable mode. And while saving the record this “statecode” field was filling with a default value and converting its mode to “dirty”. Later on, it was passing in the save record context but on the other side “statuscode” field was not getting passed. Hence, the above error message was getting displayed while saving the record.

The absurd thing occurred is that after upgrading, the field was in editable mode but CRM generally doesn’t allow to edit the “statecode” field while saving the record.

 You can see below screen that field was in editable mode:

Unable to Create or Update record after Upgrading Dynamics 365 CRM2

But when we saw the properties of the field, it is still showing in the lock mode.

Unable to Create or Update record after Upgrading Dynamics 365 CRM

Then to fix the issue, we set the “Field” to read-only mode using field properties from “Form Editor”.

Unable to Create or Update record after Upgrading Dynamics 365 CRM

So, while saving the record, this field won’t be dirty. And CRM Internal programs handles to update this field.

Conclusion:

Using the steps above user will be able to create or update records in Dynamics CRM after upgrading to newer version.

Microsoft Dynamics CRM and QuickBooks Integration

Leave a Reply