Skip to main content

On Add

Last updated 24/03/2026

Overview

The On Add event is a client-side event that executes when the Add Item button is clicked. It allows the application to react immediately after a new record creation process is initiated by the user.

How it Works

When the Add Item button is clicked:

  1. A new record is instantiated on the client.
  2. The On Add client-side event event executes.
  3. The application can manipulate the form or initialize data before the user begins entering information.

Use Cases:

  • Pre-fill fields with default values
  • Show or hide UI components dynamically for new records
  • Trigger client-side calculations or validations

Example

This function executes on record creation, capturing the current date and time and storing it as a timestamp variable.

JavaScript
Set record timestamp
function onAddEvent(five, context, result) {
five.setVariable('RecordOnAddTimeStamp', Date().toLocaleString());
return five.success(result);
}