onApplicationInit
It is the first event executed in the application, being fired even before the SQL and HTML assembly.
It works as a preparation for the application, where it is possible, among other things, to manipulate variables, perform validations and change the connection with the sc_change_connection
macro, for example.
In the example below, access to the edit form (form_orders) linked to the query will be limited, depending on the user who is accessing the application.
If the variable [usr_login]
is equal to admin, the user will have access to the form with the possibility of inserting and deleting a record.
If the variable has some other value, the user will still have access to the form, but only with the possibility of changing a record.
Samples Code
if ( [usr_login] == 'admin') {
sc_apl_conf("form_orders", "insert", "on");
sc_apl_conf("form_orders", "delete", "on");
} else {
sc_apl_conf("form_orders", "insert", "off");
sc_apl_conf("form_orders", "delete", "off");
}