Configuration initialization





This article is applicable to: managed application, mobile application, ordinary application.

This article describes the standards that apply to the actions performed during the first start of a configuration. All of the listed recommendations are mandatory unless noted otherwise.

1. The configuration must include a check whether it is started for the first time (if true, the infobase is empty and must be filled with the required minumum of data). It must also include a check whether a new release is started for the first time (if true, required infobase data updates must be executed).

If your configuration includes 1C:Subsystems Library, implement the checks using the "Infobase version update" subsystem.

If your configuration does not include 1C:Subsystems Library, follow the recommendations provided below.

This recommendation is optional

2. The initial infobase filling can be split into mandatory and optional parts. The mandatory part is required for the configuration functioning, while the optional part is not required but streamlines the first steps with the product.

3. Once the infobase processing during the first start of a configuration (or a new configuration release) is complete, we recommend that you display the configuration desciption or the change log to the administrator.

4. The configuration must control situations where the processing is not fully complete. If this is the case, a warning must be displayed to a user. For recording details of performed operations and errors that occurred during the processing, use the event log.

5. If the configuration is intended to run in distributed infobase mode, implement the infobase data update logic in subordinate nodes as follows:

  • update the subordinate node data after loading updated data from the main node; 
  • exclude repeated processing and especially repeated creation of a single piece of data. In other words, ensure correct operation of the infobase processing during its second run.

Otherwise:

  • in the event of unconditional data creation during the subordinate node update, this data is created in each node and duplicated many times during the next exchange;
  • in the event of unconditional data change during the subordinate node update, the changed data is exported back to the main node, which provides additional load to the communication link between the nodes. 

Incorrect:

ProfileObject = Catalogs.AccessGroupProfiles.CreateItem();
ProfileObject.Description = NStr("en = 'Accountant'");
ProfileObject.Predefined = True;
ProfileObject.Write();

Correct:

ProfileDescription = Nstr("en = 'Accountant'");
Query = New Query(
 "SELECT
 | TRUE 
 |FROM
 | Catalog.AccessGroupProfiles AS AccessGroupProfiles
 |WHERE
 | AccessGroupProfiles.Description = &Description AND
 | AccessGroupProfiles.Predefined = TRUE");
Query.SetParameter("Description", ProfileDescription);
// If the item is not found, create it.
If Query.Execute().IsEmpty() Then
  ProfileObject = Catalogs.AccessGroupProfiles.CreateItem();
  ProfileObject.Description = ProfileDescription;
  ProfileObject.Predefined = True;
  ProfileObject.Write();
EndIf;


Comments
0
Add comment