Execution Order of Entity Processes
To learn more about the operating states, see: System state.
Order on load
Figure: Execution order of processes when loading an Entity.
- onInit
This process runs before the RecordContainer is loaded. It is typically used to initialize variables such as$global.variableNameor$context.variableName. - beforeOperatingState
At this point, the Entity is already loaded, but no operating state has been entered yet. See System state. - afterOperatingState
At this stage, the operating state has been determined, but UI components are not loaded yet. This is the correct place to react to operating-state changes. - afterUiInit
This process runs after the UI has been initialized. You can use it for UI-related actions such asneon.addRecord. - onValidation
Use this process to validate field data before saving. It should be used only for validation and not for reacting to changes. If theonValidationprocess returns a text, ADITO automatically treats the validation as invalid, displays the message next to theSavebutton, and disables the button until the next validation run.
Example:result.string("Your input must not include special characters like '&'."); - onValueChange
This EntityField process reacts to field changes. It can be used, for example, to update derived values or to enable or disable related UI elements depending on the input.- With property
onValueChangeTypes, you can define which modifier types trigger the process, for exampleMASKorRECORD. $local.modifiertypecontains the modifier type that triggered the process. This is useful if different reactions are required for different trigger sources.
- With property
Order on save
Saving an Entity with a dbRecordContainer
Figure: Execution order of processes when saving an Entity with a dbRecordContainer.
Saving an Entity with a jditoRecordContainer
Figure: Execution order of processes when saving an Entity with a jDitoRecordContainer.
afterSave-Process
Descriptions of these processes can be found partly in their JSDoc and partly in the previous section about Load. The following additional notes are relevant:
-
afterSave
TheafterSaveprocess exists to execute client-side commands after a record has been saved. Typical examples are showing a popup message or opening another Context. The same logic should not be implemented inonDBInsertoronInsert, because RecordContainer processes are not allowed to execute client commands such asneon.xxxorquestion.xxx. In addition,openContextdoes not behave reliably there.Please note the following:
afterSaveruns exclusively on the client side. It must therefore not be used to trigger server-side changes, updates, or follow-up processes. If server-side actions are required, implement them inon(DB)Insert.- If
afterSaveopens a new Context, returnresult.string(true);to suppress the default post-save behavior.