Recently, while upgrading version 25.1, we encountered a critical error related to the Master Data Management app by Microsoft. This error halted the upgrade process, presenting the following message:
Error Details:
Could not upgrade the extension '_Exclude_Master_Data_Management' by 'Microsoft' from version '22.0.54157.55195' to '25.1.25873.25900' for tenant 'default' and company 'CRONUS USA, Inc.' due to the following error:
'Call to the function 'MODIFY' is not allowed inside the call to 'OnUpgradePerCompany' when it is used as a TryFunction.'
AL stack trace:
"Master Data Mgt. Upgrade"(CodeUnit 7238).TryModify line 2 - _Exclude_Master_Data_Management by Microsoft
"Master Data Mgt. Upgrade"(CodeUnit 7238).UpgradeJobQueueEntryFrequencies line 33 - _Exclude_Master_Data_Management by Microsoft
"Master Data Mgt. Upgrade"(CodeUnit 7238).OnUpgradePerCompany line 2 - _Exclude_Master_Data_Management by Microsoft
"Upgrade Triggers"(CodeUnit 2000000008).OnUpgradePerCompany(Event) line 2.
Root Cause
The issue was from the Master Data Management app attempting to use the MODIFY function within a TryFunction during the OnUpgradePerCompany process.
A fix has been promised in the upcoming cumulative updates for Business Central. However, until the fix is officially released, users upgrading to version 25 may face this issue.
Temporary Workaround
To bypass the error and proceed with the upgrade, you can temporarily adjust the DisableWriteInsideTryFunctions property in the server instance configuration.
Steps to Apply the Workaround:
Import-Module 'C:\Program Files\Microsoft Dynamics 365 Business Central\250\Service\NavAdminTool.ps1'
Set-NAVServerConfiguration -ServerInstance BC250 -KeyName DisableWriteInsideTryFunctions -KeyValue false
Restart-NAVServerInstance BC250
Important Note:
Use this as a temporary solution and revert the DisableWriteInsideTryFunctions property to true once the upgrade is complete.
*This post is locked for comments