Main > Knowledge Base > Best practices > Creating and changing metadata objects > Data storages > Using predefined items > Best practices > Creating and changing metadata objects > Data storages > Using predefined items > Best practices > Creating and changing metadata objects > Data storages > Using predefined items

Using predefined items

These recommendations apply to 1C:Enterprise version 8.3.3 or later (except configurations where compatibility mode is set to Version 8.2 or earlier). They are mandatory unless noted otherwise.

1.1.  You have the option to create predefined items in catalogs, charts of accounts, and charts of calculation types, both automatically or using 1C:Enterprise script. 

1.2. In most scenarios we recommend that you have predefined items created automatically because they are needed at all times and because this simplifies calling them from 1C:Enterprise script. Examples of such scenarios are the predefined USA item in the Countries catalog and the predefined Administrator access group profile.

For the automatic creation, do the following:

1.3. Subordinate nodes of distributed Infobases are exceptions to this rule. In such nodes predefined items must not be created or updated automatically. Instead, they must be replicated from the master node together with the configuration changes.

In this case ensure the following:

a) The configuration loads an exchange message to a subordinate node prior to the execution of the script that accesses predefined items retrieved from the master node.

b) The applied logic of loading data from the master node (for example, the OnReceiveDataFromMaster handler and object registration rules) does not include accessing predefined items because you cannot be sure that they have already been loaded from the exchange message.

c) The Infobase update handler script that processes predefined items is not executed in subordinate Infobase nodes:

If ExchangePlans.MasterNode() = Undefined Then
    // fill predefined items
    // ...
EndIf;

1.4. We recommend that for tables with predefined items that are not included in the distributed Infobase exchange plan (and are not referenced by other tables included in the exchange plan) you set the PredefinedDataUpdate property to AutoUpdate.

If you use the compatibility mode with version 8.3.3, on the first start of a subordinate node (right after its configuration update) set automatic data update using the following script:

Catalogs.<CatalogName>.SetPredefinedDataUpdate(PredefinedDataUpdate.AutoUpdate);

2. In some cases automatic creation of predefined items is not required. This includes cases when the availability of predefined items depends on some condition (functional option values, application mode, and so on).

For example, the availability of predefined items in the Accruals chart of calculation types can depend on the values of the following functional options: UseHourlyWorkTimeRecords, UsePieceworkWages, and so on.

If this is the case, do the following:

If GetFunctionalOption("UseHourlyWorkTimeRecords") Then
    AccrualObject = ChartsOfCalculationTypes.Accruals.CreateCalculationType();
    AccrualObject.PredefinedDataName = "HourlyPayment";
    // ...
    AccrualObject.Write();
EndIf;

  ... = ChartOfCalculationTypes.Accruals.HourlyPayment;
  ... = PredefinedValue("ChartOfCalculationTypes.Accruals.HourlyPayment");

Next page: Using the Active property of register records
 





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