Skip to main content

On Selection

Last updated 19/03/2026

Overview

The On Selection event is a client-side event that executes whenever a record is selected from a list. It lets the application react immediately to the selection.

If a Do Create server-side function exists, it runs first. The On Selection event always runs after the record is available on the client.

How it Works

When a record is selected from a list:

  1. Optional: The server runs a Do Create function if one exists.
  2. The record appears on the client.
  3. The On Selection client-side event executes and accesses the selected record via
    five.form
    .

Use Cases

  • Update UI components
  • Trigger calculations or validations
  • Filter related lists or lookups
  • Prefill forms

Example

This function runs whenever a customer is selected in the list. It saves the customer key globally so other parts of the application can use it.

JavaScript
Track record access
function OnSelectCustomer(five, context, result) {
/* set the current customer we are viewing, we can now use the
variable globaly in the application to update any information
about the customer */
five.setVariable('selectedCustomerKey', five.form.Customer.CustomerKey)
return five.success();
}