K2 5.0 to K2 5.1 upgrade failed with error: "One or more items was not found"
After performing a K2 5.0 to K2 5.1 upgrade, the Configuration Analysis Tool reported that the following P&D packages did not deploy successfully:
After clicking the "Apps" button in Workspace, we received the following error:
"Object reference not set to an instance of an object"
Looking at the installer trace logs, the following error was found:
"Error: System.Exception: One or more items was not found
Guid: 'a5d9c236-0d64-4e67-b9f0-01e098c83e36';ContextType: 'View'
Guid: '3d6194f4-2311-42c6-b0df-78e4956fff7a';ContextType: 'View'"
After running a SELECT query on the "Form.View" and "Form.View_Design tables", I did not find any view with those GUIDs as an ID. (After running the same query on a known good VM, I found two views with corresponding GUIDs.)
They were for the the following views:
- Friendly name: "Form Header - Full"
System Name: com.K2.App.Framework.Core.ItemView.FormHeaderFull
- Friendly name: "Form Footer"
System Name: com.K2.App.Framework.Core.ItemView.FormFooter
On the environment showing errors, I did find views with the same system name, but their GUIDs were different. After "extracting" the P&D packages I found these views in the "App Framework Core.KSPX" package. The view ID was the exact same GUIDs that was found in the logs, and the exact same GUID that was found in the test environment.
The Apps Team confirmed that these are system views, and will always have the same GUIDs. P&D tried to deploy a couple of system packages and failed, because those views already existed but with different GUIDs.
Run the following queries, to update the system names of the eronious views:
SET [Name] = 'com.K2.App.Framework.Core.ItemView.FormHeaderFull.Renamed'
WHERE [Name] = 'com.K2.App.Framework.Core.ItemView.FormHeaderFull'
SET [Name] = 'com.K2.App.Framework.Core.ItemView.FormFooter.Renamed'
WHERE [Name] = 'com.K2.App.Framework.Core.ItemView.FormFooter'
Using P&D, deploy the packages found in the "C:Program Files (x86)K2Setup" folder, in the following order:
- Deploy "App Framework Core.kspx"
- Deploy "App Installer.kspx"
- Deploy "App Framework Extension Notification.kspx"
- Deploy "App Wizard.kspx"
After opening "Apps" in "Workspace" the error was gone, and the apps page functioned as expected.