Before Process
The Before Process is the first code event. It runs before anything is processed for a screen.
This is a server-side ProcScript event.
Please note that there is no item data available at this point.
Available Variables
The following variables are exposed here:
translations
- {"Title":"Heading", etc}
location
- current URL, eg "https://procdu.com/mcapp/id/screen" - change to redirect
url_parameters
- array of passed URL parameters, eg ?id=123 ⇒ {”id”:123}
my_variables
- Array of keys and values - these are yours to change
custom_tokens
- Array of keys and values you can use later in markdown or defaults (eg custom_tokens.foo = "bar" - then use @[pf_custom:foo]
is_logged_in
- true/false
auth_item
- Raw item used in authentication or null (eg: {item_id:1234, fields:[...], etc})
auth_item_values
- Simplified authenticated user item or null (eg: {title:"foo", number:2, etc})
Examples
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
As always, use-cases are endless. Just remember you have no item data at this point.