Scope: managed applications, mobile applications, and ordinary applications.
Applies to 1C:Enterprise 8.3.3 platform version and higher without compatibility with version 8.2.
1.2. In most cases, we recommend that you create predefined items automatically as they are always required and it is necessary to simplify access to these items from code.
For example, the predefined country USA in the World countries catalog, the predefined profile of access groups Administrator, and other.
To automatically create predefined items:
- In the UpdatePredefinedData property of the catalog, chart of accounts, chart of characteristic types, or chart of calculation types, set the Auto value (by default), and do not allow programmatic calls of the SetPredefinedDataUpdate method of these objects to switch from this mode.
- Prevent predefined items from being deleted by users by disabling the following rights in all roles (disabled by default):
1.4. For tables with predefined items, which do not belong to the DIB exchange plan and to which other tables of the DIB exchange plan do not refer, the PredefinedDataUpdate property must be set to the UpdateAutomatically value.
The Auto value is not suitable in this case as Auto means DontAutoUpdate for a subordinate node. Predefined table items will not be automatically created.
When a compatibility mode with version 8.3.3 is enabled, upon the first start of a subordinate DIB node, set an automatic data update using the following call:
For example, predefined calculation types in the Accruals chart of calculation types depend on values of functional options UseTimeRecordKeepingOfEmployeesInHours, UsePieceworkEarnings, and other.
To restrict automatic creation of predefined items:
- In the PredefinedDataUpdate property of the catalog, chart of accounts, chart of characteristic types, or chart of calculation types, set the value to "Do not update automatically"
- Provide the creation code (and marking as invalid) of the predefined item depending on the business logic, for example:
If GetFunctionalOption("UseTimeRecordKeepingOfEmployeesInHours") Then
EarningObject = ChartsOfCalculationTypes.Earnings.CreateCalculationType();
AccrualObject.PredefinedDataName = "HourlyPay";
- Upon creating the application code, take into account that predefined items are missing in the infobase. Otherwise, when accessing a non-existing predefined item from the code or query text, an exception will be thrown:
... = ChartOfCalculationTypes.Earnings.HourlyPay;
... = PredefinedValue("ChartOfCalculationTypes.Earnings.HourlyPay");
If Standard Subsystems Library (SSL) 2.1.4 and higher is used in the configuration, use the PredefinedItem function of the Common or the CommonClient common module. The function returns Undefined for predefined items that do not exist in the infobase:
... = CommonClient.PredefinedItem("ChartOfCalculationTypes.Earnings.HourlyPay");