Predefined data: troubleshooting





While working with predefined data, you can come across the following issues:

  • An attempt to access a predefined item leads to the following error: "The predefined item is not found in the infobase data". Possible reasons:
    • It is a subordinate node and predefined data items available in the central node have not yet been loaded.
    • The infobase data was initialized when predefined data update was disabled for the entire infobase or for a specific metadata object.
    • Predefined data was deleted.
    • The value of PredefinedDataName attribute of predefined data was cleared.
  • Duplicate predefined data items are detected (two or more data records have the same value of PredefinedDataName property). Possible reasons:
    • Predefined data items were created with DataExchange.Load set to True. For example, this can occur in scenarios featuring distributed infobases.

Troubleshooting

It is recommended that you enable recording events of "Information" level to the event log at all times.

Predefined data items are not found

Filter the event log by metadata object whose data is missing and by the following event types:

  • Data:
    • Modify predefined data
    • Delete predefined data
    • Set predefined data initialization
  • Infobase:
    • Predefined data update
    • Set predefined data update

Events in the list can show why the predefined item is not found.

If the log contains an event of Data.Modify predefined data type, which has an empty string as a predefined data name, it means that a user or 1C:Enterprise script fragment cleared the predefined data name, making the item not predefined. To restore the item, return the previous value to the PredefinedDataName property. It is recommended that you correct your configuration in order to prevent this situation in the future (for example, change access rights or modify the script fragment).

If the log contains an event of Data.Delete predefined data type,  it means that predefined data was deleted by a user or from 1C:Enterprise script. To correct this, create the missing predefined item. It is recommended that you correct your configuration in order to avoid deletion of predefined data that is used in the application algorithms.

If the log contains an event of Data.Set predefined data initialization type where a predefined data initialization flag is set, it means that setting the flag was attempted from 1C:Enterprise script but some (or all) of the predefined items were not created. It is recommended that you correct your configuration (ensure that either all of the predefined data items are created or the missing items are never accessed).

If the log contains an event of Infobase.Predefined data update type that includes the comment "Predefined data update disabled", it means that the predefined data update is disabled at infobase, node, or metadata object level. In this scenario the platform does not perform the restructuring of predefined data. To identify the source of the issue:

  • Ensure that it is not a subordinate node. In a subordinate node, predefined data is loaded from the central node. This is why your application logic should provide the option to load the changes from the central node before the first attempt to access predefined data.
  • Analize the events of Infobase.Set predefined data update type where predefined data update is disabled. If predefined data update was disabled before the configuration update, enable the automatic update of predefined data using the SetInfoBasePredefinedDataUpdate method (if it was disabled for the entire infobase) or the SetPredefinedDataUpdate method (if it was disabled for a specific metadata object). It is recommended that you correct your configuration in order to prevent this situation in the future. Create the missing predefined data items or remove the script that accesses the missing items.
  • Validate the configuration. Probably the metadata object property PredefinedDataUpdate is set to DontAutoUpdate. If this is the case, correct this error.

Duplicate predefined data items.

Duplicates can appear only in data load mode (DataExchange.Load set to True). In this scenario the platform does not check whether predefined data items are unique.

If the event log contains records of Data.Add predefined data type with duplicate PredefinedDataName values, it means that predefined data duplicates are created from 1C:Enterprise script, for example, they were loaded during data exchange.

If the event log contains records of Data.Modify predefined data type with duplicate PredefinedDataName values, it means that duplicates of predefined data are created by a user or from 1C:Enterprise script, for example, they were loaded during data exchange or the load mode specified in the item form is incorrect and the user was able ro specify a duplicate name.

To correct the issue, first decide which item is the correct one (for example, by checking the references to predefined data items), and then make the other item regular (not predefined) by clearing the PredefinedDataName field. Before deleting the item, check whether a replacement of references to this item with the references to the correct item is required.

Guidelines for working with predefined data

If you do not plan to manage predefined data from 1C:Enterprise script and you assume that it is always in the database, do the following:

  • Restrict access to predefined data, so that no one can delete or clear the PredefinedDataName property.
  • Avoid predefined data modification in privileged mode.
  • Avoid modification of predefined data in the data load mode (when the DataExchange.Load property is set to True).
  • Do not disable automatic predefined data update.

Remember that the platform does not create predefined data items in subordinate nodes. Instead, they come from the central node. Thus, when you develop applications that run as distributed infobases, pay attention to the predefined data update at the first start of the application and ensure that the application does not attempt to access the predefined data when it is not yet loaded from the central node.


Comments
0
Add comment