Desktop version

Main > Knowledge Base > Best practices > Code conventions > Using 1C:Enterprise script clauses > Getting object metadata > Best practices > Code conventions > Using 1C:Enterprise script clauses > Getting object metadata > Best practices > Code conventions > Using 1C:Enterprise script clauses > Getting object metadata

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();

Next page: Initializing local variables in advance




© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.