In the previous post I explained why automatically running Codeunit 2 Company Initialization during the data upgrade could be a problem. Main problem is the language used during the data upgrade. It can’t be set with the Start-NAVDataUpgrade cmdlet and as a result the company initialization is executed in ENU instead of the local language. And I said that since Codeunit 2 initializes Workflow you will end up with an English workflow library. So I recommended to use the –SkipCompanyInitialization switch on the Start-NAVDataUpgrade cmdlet.
Well, it turns out that this advice did not the complete trick…
This week I ended up with an upgrade that still contained an English workflow library instead of a Dutch one. Regardless of the SkipCompanyInitialization.
The upgrade codeunit also contains a function that initializes the workflow library. That’s because of approvals being upgraded to workflow. And since this code resides in the upgrade codeunit, it is executed in ENU.
It has been reported to Microsoft that we need a –Language parameter on the Start-NAVDataUpgrade cmdlet. And I got the response that I was not the first one to report this and that they now have requested the development department for this parameter.
While we are waiting for this parameter to be added, I have a temporary solution for you.
Open the upgrade codeunit. This can be one of these codeunits:
Search for the UpdateApprovalsManagement function
Change this function to normal.
As a result, the code will not be executed during the data upgrade. Now you have the opportunity to run this function separately in the correct language by using the the Invoke-NAVCodeunit cmdlet.
The data upgrade procedure will now look like:
- Run Start-NAVDataUpgrade
- Execute UpdateApprovalsManagement in your local language
- Execute Codeunit 2 in your local language
Here is the PowerShell for your convenience. Check the correct codeunit id, depending on the version your are upgrading from. And don’t forget to change the language parameter. 😉
Start-NAVDataUpgrade -ServerInstance $navserverinstance -FunctionExecutionMode Parallel -SkipCompanyInitialization -Force Get-NAVCompany -ServerInstance $navserverinstance | Invoke-NAVCodeunit -ServerInstance $navserverinstance -CodeunitId 104050 -MethodName 'UpdateApprovalsManagement' -Language 'nl-NL' Get-NAVCompany -ServerInstance $navserverinstance | Invoke-NAVCodeunit -ServerInstance $navserverinstance -CodeunitId 2 -Language 'nl-NL'
Hopefully we can skip this temporary solution in one of the next cumulative updates!
One more thing…
During recent upgrades I also stumbled over the next error. Sorry for the Dutch message, hopefully you can recognize it.
The function CreateOverdueSetup in the upgrade codeunit has an incorrect parameter in the call to NotificationEntry.CreateNew. Parameter NotificationTemplate.Code should be NotificationTemplate.
Wish you lot of success with upgrading!