Go to Scriptcase store

# onScriptInit - Grid
View video

This event occurs every time the application is loaded or reloaded.

Second event to be executed, before the execution of the main select, it is triggered whenever the application is loaded. For example, after using the advanced filter.

In it, all application variables and libraries are available for use.

The manipulation of connections with `sc_connection_edit` and `sc_connection_new` macros, manipulation of the main select with `sc_select_order` and `sc_select_where(add)` macros and inclusion of libraries already incorporated into Scriptcase such as Jquery with `sc_include_lib` macro are some of the examples of using the event.

In the example below, access to the sales report will be limited to the user who performed them.

Access is limited if the user is not the admin.

Sample Code

`if ( [usr_login] != 'admin' ) {`

```if ( empty({sc_where_atual})){`

`sc_select_where(add) = "WHERE employeeid > [usr_login]";`

`} else {`
``

`sc_select_where(add) = "AND employeeid > [usr_login]";`
`}
}`