Getting object metadata





This article describes the standards that apply to getting object metadata. All of the listed recommendations are mandatory unless noted otherwise.

1. If you can determine the metadata object type (catalog, document, and so on), get the configuration object metadata using the Metadata method of this object (for objects of referential type, use the Metadata method of the reference).

Do not use the Metadata global context method in this scenario because its execution is significantly slower.

Correct:

CatalogObject.Metadata

Incorrect:

Metadata.Catalogs[CatalogName]
Metadata.FindByFullName("Catalog." + CatalogName)

2. If you cannot determine the metadata object type in advance, use the FindByType method.

Example:

// Get the full metadata object name by reference in the following format: 
// "Catalog.Items", "Document.GoodsReceipt" 
MetadataObjectName = Metadata.FindByType(TypeOf(Ref)).FullName();

Comments
0
Add comment