Event Subscription

You can use event subscriptions to assign event handlers for an object or a group of objects in 1C:Enterprise script.

When you add a new event subscription, in addition to the common configuration object properties you should also specify an event source, an event for the assigned handler, and a procedure that handles the event.

Event sources can be application objects and register record sets defined in the configuration. You are allowed to select objects as sources for multiple events.

You should select an event in the drop-down list that contains events that are present in all selected objects. Otherwise, the list will be empty.

Then you should select an event handler procedure.

When the specified event occurs, the following action sequence is performed:

  • the event is first processed in the object and calls the handler defined in the object or record set module;
  • if the handler is performed while the Cancel parameter is set to True or an exception is called, the action is aborted;
  • then external event handlers are called in random order;
  • the object (record set) that has called the event is passed to the assigned handler as a source;
  • if the assigned handler is performed while the Cancel parameter is set to True or an exception is called, the action is aborted.

The assigned event handlers are called in the same context as the action that has called the event. If you need to run the assigned handler in the server cluster, you should include a call to the common module procedure performed in the cluster to the handler code.

You can also assign event handlers by using 1C:Enterprise script. To do that, use the AddHandler and RemoveHandler operators.

1C:Enterprise Developer's Community