So, the "Object Module" is designed to handle standard events. For example, an event to enter a catalog item, an event to write an item, delete, post a document and etc.
Basically, the write event also exists in the form module. But the write event in the form module occurs during interactive recording when working with a specific form.
The event "Write" in the object module will be executed on any write from any form of the given object. In addition, if the object is written programmatically, then the event of the object's module is triggered.
In the "Object module" you can embed all the checks for the correctness of the recorded data since, at the moment of recording the object, this procedure will be performed absolutely for any record.
In the "Object module" you can place a section for describing variables, describe arbitrary functions that may or may not be associated with an event, as well as a section of the main program.
In the main program section, you can, for example, initialize the local variables of this module. This program code will be executed when accessing this "Object module".
It should be noted that all procedures of the Object Module are compiled on the Server. Accordingly, the compilation directives ("&AtServer") don't need to be specified for the procedures and functions of the Object Module.
In Object Modules, you can describe methods that can be exported, and these methods will be available from outside.
Those. in addition to using the fixed methods of the object class, you can create additional methods for the object in the Object Module. This module should describe the corresponding procedure with the Export keyword.
Then it will be possible to refer to this procedure from outside. Moreover, this method will be displayed in the context tooltip. New methods in the context tooltip are highlighted in blue (blue p() for procedures and f() for functions). Pls see screenshot 1.
Similarly, you can create a new property by declaring a variable with the Export keyword. This property can also be accessed from outside. (scr. 2)
Thus, it's possible to expand the functionality of objects (to redefine new methods and new properties). However, the properties are dynamic and are not stored in the database.
If you need to use a property for an object that will be stored in the database, you must create an object attribute.