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

Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.