Got the below error while trying to update a field on the Order when it is read-only from a button using JS (Used custom security roles).
Below is the error log downloaded, and the Out of the box plugin is preventing the update after the Order status changed.
Exception Message: Cannot Update a Read-Only Entity
ErrorCode: -2147220946
HexErrorCode: 0x8004022e
ErrorDetails:
HttpStatusCode: 400
TraceText:
[Microsoft.Dynamics.Sales.Plugins: Microsoft.Dynamics.Sales.Plugins.PreOperationSalesOrderUpdate]
[fba59793-5468-e611-80e8-00155d2920d8: Update of Sales Order]
Entered Microsoft.Dynamics.Sales.Plugins.PreOperationSalesOrderUpdate.Execute(), Correlation Id: 9db6b43e-6e3f-466b-8170-7f34664538e1, Initiating User: f695d62d-99af-ea11-a812-000d3a795180
Exception: Microsoft.Dynamics.Solution.Common.CrmException: Cannot Update a Read-Only Entity (Fault Detail is equal to Exception details:
ErrorCode: 0x8004022E
Message: Cannot Update a Read-Only Entity
StackTrace:
at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at Microsoft.Dynamics.Solution.Common.CrmException.BuildOrganizationServiceFault(Exception innerException, Int32 errorCode, Int32 statusCode, String message)
at Microsoft.Dynamics.Solution.Common.CrmException..ctor(String message, Exception innerException, Int32 errorCode, Int32 statusCode, Boolean isFlowControlException, Boolean enableTrace)
at Microsoft.Dynamics.Solution.Common.CrmException..ctor(String message, Exception innerException, Int32 errorCode, Int32 statusCode, Boolean isFlowControlException)
at Microsoft.Dynamics.Solution.Common.CrmException..ctor(String message, Int32 errorCode)
at Microsoft.Crm.Sales.ObjectModel.SalesOrderService.ValidateForUpdate(Order preImage, Order salesOrder, IPluginContext context)
at Microsoft.Dynamics.Sales.Plugins.PreOperationS…)., Correlation Id: 9db6b43e-6e3f-466b-8170-7f34664538e1, Initiating User: f695d62d-99af-ea11-a812-000d3a795180
Exiting Microsoft.Dynamics.Sales.Plugins.PreOperationSalesOrderUpdate.Execute(), Correlation Id: 9db6b43e-6e3f-466b-8170-7f34664538e1, Initiating User: f695d62d-99af-ea11-a812-000d3a795180
Activity Id: 839c2e14-2084-4425-b579-cf511446902c
I tried with System Administrator role, there is no such issue, with the update using Level Up Tool.
Then, I debugged the JS, but did not see any issue logged in the console using the custom role.
Found the below article after thorough research, and understood we cannot directly update the orders without System Administrator or Integration user role (check the below article).
MSDyn365 Internals: Read-only Sales entities – Mark Carrington
So, I changed the approach to update the field value from the Custom Page with a power automate on a button click, then it worked smoothly without any issue.
Hope you got the solution to this problem.
Please like and share your valuable feedback on this article and follow my blog to get my articles to your Inbox.
Click on the below image to navigate to my YouTube Channel.
Below are my earlier articles that you can have a look.
Resolved: Fix connections issue in Power Automate Flow
Clear all objects feature in Power Apps Solutions
Dynamics 365 CE Solution Import Failed in Azure DevOps Pipelines
Error while opening a Tool in XRMToolBox
The Power Automate Cloud Flows Best Practices Whitepaper is now LIVE!
How to get the Dataverse Table’s first row from List Rows in Power Automate?
Microsoft Dataverse Accelerator – Part 2 – Installation
Microsoft Dataverse Accelerator – Part 1 – Introduction
How to get the Database Version of the Dataverse?
API playground feature not available in Dataverse Accelerator App?
How to Explore and test Dataverse in the Web API playground (preview)?
Web resource method does not exist in Dynamics 365 CE
How to get Environment Variable Value in Dynamics 365 CE using JavaScript?
Model-driven Apps – openAlertDialog – JavaScript – Code Snippet
Power Automate – Flow is not running on Trigger condition
Power Automate – Input field Delete option is disabled
Recipient of type ‘Contact’ with ID is marked as non-emailable
Preferred Solution | New feature | Microsoft Dataverse
New and Retired Microsoft Dynamics 365 Certifications
Environment settings behavior (Preview) feature in Model-driven Apps
Error while connecting to Dataverse environment in XrmToolBox
Power Fx Formula Columns in Microsoft Power Apps
How to Enable 2024 Release Wave 1 Updates in the Microsoft Dynamics 365 CE Environment?
Delete and Restore records (Preview) feature in Microsoft Dataverse
Microsoft Power App Environments Retention Period
How to Override the Model-driven app header colors?
Timeline Highlights (New feature) in Microsoft Power Apps
Model-driven App – Cannot “See associate records” option in the sub grid (arunpotti.com)
Bookmark the Important Dynamics 365 URLs
How to Enable Tenant-level analytics for Power Automate and Power Apps?
Microsoft Power Automate Copy and Paste Action in New DesignerHow to Setup Multi-Factor Authentication for your Microsoft Power Apps environment?
Microsoft Power Apps | Modern Themes | Preview feature
How to Download and Install the .NET Framework?
How to Create a SharePoint Site Online?
How to add and use Copilot answer control (Preview) in Microsoft Power Apps?
Dark Mode in Microsoft Power Apps
How to create Microsoft 365 E3 Trial for 30 days?
Refreshed look of solution dependencies in Dataverse Solutions
Microsoft Power Automate | Version History | Restore | New Feature
MICROSOFT LEARN – Artificial Intelligence Skills Challenge 2024!!!
How to Create Microsoft Power Apps Trial 30 days?
Not able to Create Power Automate Flow in Custom Page in Model-Driven App?
How to Enable Inline Actions feature in Microsoft Canvas Apps?
How to use /mention in Outlook web client for Dataverse records?
Associate Activities Multiple Related Records (Preview) feature in Microsoft Dynamics 365 CE
How to Enable Aggregation (preview) feature in Microsoft Power Apps?
How to Enable the SQL Server stored procedures (preview) feature in the Power Apps?
How to get the Client Version of the Model Driven Apps?
How to get Microsoft 365 E3 Trial for 30 days?
How to Enable Copilot for Model-Driven apps feature in Dynamics 365 CE Environment?
[Resolved] Web resource method does not exist in Dynamics 365 CE JavaScript Error
How to Enable Blocking unmanaged customizations (Preview) feature in Dynamics 365 CE?
How to create Microsoft Power Apps Developer Plan Environment?
Microsoft Power Apps Developer Plan vs Power Apps Trial 30 days
What is Microsoft Power Apps Developer Plan?
[Resolved] PCF Field Control not showing anything in the PCF Test Environment?
How to Turn Off the Modern Look in the Model Driven Apps?
How to Turn on the New modern, refreshed look for the Model-Driven apps?
Microsoft Power Apps – Apps filter feature
How to Create Microsoft Power Apps 30 days Online Trial Version and an Environment?
Microsoft Power Apps – Solutions filter Preview feature
How to Show the Power Automate complete Expressions?
Power Automate Error: You should specify a contact or account.
How to get the Choice Text and Value in the Dataverse using JavaScript?
Microsoft Dataverse Low Code No Code Plugins
How to convert the Number String to Number Array?
How to Integrate Instant Plugins in the Power Automate Flow?
Power Apps – ‘actionname’ is an unknown or unsupported function in namespace ‘Environment’
Dataverse Browser V1.1.0.1 is available for Dataverse Plugin Debugging
How to Integrate Instant Plugins in the Canvas App?
How to Enable Access to Microsoft Dataverse Actions (Preview feature) in the Power Apps?
How to Create an Instant Plugin in the Dataverse Environment?
How to Install the Microsoft Dataverse Accelerator in the Dataverse Environment?
What is Microsoft Dataverse Accelerator?
How to get the Logged in User Information in the Power Apps?
How to Install Power Platform Tools in Visual Studio Code?
How to Install the Apps from the Microsoft AppSource to your Dataverse Environment?
Microsoft Power Apps Maker Portal has a new look
Microsoft Power Apps Emulator (New Feature)
How to Enable the Dataverse Offline (Experimental Feature) in the Canvas Apps?
How to set the Authoring Version in the Canvas App?
New version of Dataverse Browser is available for Dataverse Plugin Debugging
Latest Free Practice Assessments for Microsoft Certifications
Download CRM 365 V9.X Tools using PowerShell
How to set the Refresh cadence for a Power Platform Environment?
Update forms and views (Preview feature) in Dataverse
How to connect to Microsoft Dataverse in Power Automate Flow using Service principal?
How to Enable Copilot (Preview) feature in Canvas Apps?
How to Debug a Dataverse Plugin without Installing the Profiler in the Plugin Registration Tool?
How to Enable the Licenses (Preview) feature for a Power Platform Environment?
How to Enable Maker Welcome Content (preview) in Power Apps Maker Portal?
How to Enable Managed Environments for a Dataverse Environment?
How to Enable the Modern Controls (Preview feature) in the Canvas Apps?
How to Enable 2023 Release Wave 1 updates in the Dataverse Environment?
How to Deploy Enterprise Applications in the new Dataverse Environment?
What is Preview, Experimental and Retired features in Canvas Apps?
How to Enable the New Power Fx Formula Bar in Power Apps Studio?
Writing Power Fx formulas with natural language
Power Fx Formula Columns in Dataverse
Generating Power Fx formulas from examples
How to Create Dynamics 365 Marketing 30 Days Trial Version Online?
How to disable Multi-Factor Authentication (MFA) on Dynamics 365 Login?
How to Create Microsoft Power Apps 30 days Online Trial Version and an Environment?
Original Post https://arunpotti.com/2025/02/28/error-the-object-cannot-be-updated-because-it-is-read-only-in-microsoft-power-apps/