On Sub Form Complete
Last updated 26/03/2026
Overview
The On Sub Form Complete event is a client-side event that executes when the Save button is clicked in the form app bar of a sub-form. It allows the application to respond immediately after the sub-form data has been updated, but before additional processing or sever-side actions occur.
How it Works
When the Save button is clicked in a sub-form:
- The sub-form data is prepared for submission on the client.
- The On Sub Form Complete client-side event executes.
- The application can perform logic or validations before the save is processed.
Context Properties
This event provides a
context
object with useful properties:- context.record- contains the updated data from the sub-form that was just saved
- context.records- contains an array of all records in the current sub-form list
Use Cases
- Validate sub-form data before it is saved
- Update values in the parent form based on sub-form changes
- Display confirmation or warning messages
- Trigger calculations using sub-form data
Example
This function executes immediately after a sub-form's Save button is clicked, allowing access to the updated sub-form data and the full list of sub-form records before any server-side processing occurs and updates the parent field MemberCount based on how many entries exist.
function OnSubformComplete(five, context, result) {
// Update MemberCount with the number of sub-form records
five.field.MemberCount = context.records.length;
return five.success(result);
}