Search code examples
pluginsdynamics-crmmicrosoft-dynamicsdynamics-365dynamics-crm-365

How can you update a field that is locked by system via Plugin?


I have a field in my contract line entity that is locked by the system as shown here:

enter image description here

I want to update this field using a plugin via the following code:

//Update Contract Line StartDate
                    Entity updatedContractLine = new Entity("contractdetail")
                    {
                        Id = entity.Id
                    };

                    updatedContractLine["activeon"] = startDate;
                    service.Update(updatedContractLine);

Would this work? If not, how can I make it work?


Solution

  • Field behavior - Field is read-only:

    This helps to render the form control in disabled mode. Just related to user experience.

    Locking - Lock the field on the form:

    This just locks the attribute in the form editor from being removed from the form by Developer/Customizer. Just related to design mode.

    Red & Black padlocks

    In a nutshell, those properties has nothing to do with sdk update. You can update any attribute including activeon which is not marked as read-only by SDK. For Ex. CreatedOn, allotmentsoverage, etc are Read-only properties. Read more