App Builder \ Code Events
Before Process
Thaha
App Builder & Automation Expert
Stay Updated with ProcFu!
Subscribe to our newsletter for the latest tips, updates, and automation insights.
Subscribe Now- This is a server-side event and utilize ProcScript. So you have access to the entire Functions API library.
- This code executes before any screen processing begins, meaning the data for the screen has not yet loaded. So, you do not have access to the screen's data at this point.
- It serves as the perfect place for variable initialization or actions that need to occur before loading data.
- This event is available both app-wide and for individual screens. For code that should run at the start
of every screen, place it in
App Configuration > Before Process
. For screen-specific code, use theBefore Process
event of that screen. - The following variables are available:
translations
: Allows translation of elements on the current screen. More information available at the translations page.location
: Returns the current URL. Changing this value redirects the page to the new URL.url_parameters
: Provides an array of the parameters passed to the URL.my_variables
: Enables access to previously set variables and allows setting new ones.custom_tokens
: Access and set custom tokens here.is_logged_in
: Indicates whether a user is logged in (true) or not (false).auth_item
: Returns the authenticated user's item as raw JSON, including values, config, etc.auth_item_values
: Isolates just the data values from the "auth_item", omitting configuration details and other metadata.current_context
: Identifies the current screen's ID.- Let’s say you want to change the Save button to say Commit instead:
translations["Save"] = "Commit"
- You have a “role” field on your user record and want to make sure only managers can access this
screen:
if ( auth_item_values["role"] != "manager" ) { throw "Not authorized" }
- Maybe you want to save a field from the authenticated user record for use in a field default value
as a markdown token:
custom_tokens.role = auth_item_values.role // use as @[pf_custom:role] in field default