Last active
September 19, 2021 10:25
-
-
Save vkostyanetsky/ca766fe281425953e0e2bbfe12fc70e2 to your computer and use it in GitHub Desktop.
How to reproduce the "Metadata not found" error for data history?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Choose a victim for our bloody experiment. | |
MetadataObject = Metadata.Catalogs.Items; | |
ObjectsManager = Catalogs.Items; | |
// Enable data history for the catalog. | |
Settings = New DataHistorySettings; | |
Settings.Use = True; | |
DataHistory.SetSettings(MetadataObject, Settings); | |
// Create a new data history version. | |
Selection = ObjectsManager.Select(); | |
Selection.Next(); | |
CatalogObject = Selection.Ref.GetObject(); | |
CatalogObject.Lock(); | |
CatalogObject.Description = CatalogObject.Description + " (updated)"; | |
CatalogObject.Write(); | |
// Disable data history for the catalog and delete all stored versions. What could possibly go wrong? | |
DataHistory.SetSettings(MetadataObject, Undefined); | |
DataHistory.DeleteVersions(MetadataObject); | |
// Well, try to update data history and then... BOOM | |
DataHistory.UpdateHistory(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Заметка