Up to this point we have ignored the fact that we have no sure way of determining whether a specific item in the MaterialsAndServices catalog is a material or a service. The fact that you have arranged all catalog items into certain groups is not a reliable basis for such a decision, since groups can be deleted or renamed, items can be grouped by another principle, and so on.
Therefore, we need some kind of a marker that will clearly define whether a catalog item belongs to materials or to services, irrespective of changes to the catalog hierarchical structure.
In this lesson you will create an attribute for the MaterialsAndServices catalog using the data type described by a configuration object that you have not encountered yet, an Enumeration. As you move forward, this will let you easily classify catalog items of the MaterialsAndServices catalog as services or materials.
Additionally you will update the posting procedure of the Services document and learn how to work with enumerations using 1C:Enterprise script tools.
The Enumeration configuration object is intended to describe a structure for storing constant value sets that cannot be modified at run time. On the basis of an Enumeration object the platform creates a database table that stores a set of constant values.
In practice, this object can store options for calculating prices (such as "VAT included" or "without VAT"). The assortment of enumeration values is defined during configuration development and users cannot add, modify, or delete values.
This leads us to an important enumeration feature: enumerated values are significant to the configuration, and 1C:Enterprise script algorithms can rely on them.
Learn more! For details on the structure of 1C:Enterprise script objects intended for enumeration operations, see section Quick developer reference. Enumerations.