App Builder
Code Events

App Builder & Automation Expert
Code events allow you to add custom functionality and interact with your app's data at specific points within the user experience. ProcFu provides various events for different screen types, giving you precise control over how your app behaves.
There are eight primary code events available: Before Process, Before Render, On Render, On Row Select, On Auth Success and On Auth Fail, Before Submit and After Submit.
Types of Code Events
Code events in App Builder are divided into two main categories based on the execution environment:
- Server-Side Code Events: Utilize ProcScript, a scripting language designed specifically for server-side logic in App Builder.
- Client-Side Code Events: Employ JavaScript, allowing for dynamic interactions within the user's browser. These events are ideal for manipulating the DOM, updating styles such as color, or enhancing the interface with interactive elements.
The Sequence of Events
When rendering a Screen the sequence of events for rendering a screen is as follows:
- Before Process Event: This is the first event that gets rendered when an app is loaded. First, the app-wide before process code is executed, followed by the screen-specific before process code.
- Next, the screen is rendered including the header, footer, and a wireframe placeholder for the body.
- Here the data necessary for the screen is gathered.
- Before Render Event: You have the data for the screen now. Any modifications before the final render can be made.
- Wireframe Replaced: The initial wireframe placeholder is swapped out for the actual content.
- On Render JavaScript Event: Executes JavaScript that is specific to the rendered screen.
Available Variables
Each event has placeholder comments that specify the variables available for manipulation. These variables contain data relevant to the current context of the event.

App-Wide Code Events
ProcFu offers app-wide code events that allow you to customize the overall appearance and behavior of your app beyond individual screens. These events are accessible through the "App Configuration".

Throwing Errors
The throw
command enables you to generate errors programmatically in any coding event, including
both ProcScript and JavaScript. For example, to ensure that only managers can access a certain screen, use
the code below:
if (auth_item_values["role"] != "manager") {
throw("Not Authorized");
}
Redirecting
Use the goto_screen
command to programmatically redirect users from any screen during any code
event in ProcScript or JavaScript. For example, to redirect managers to a designated dashboard based on
their role, use the code below:
if (auth_item_values["role"] == "manager") {
goto_screen("manager_dashboard");
}