Default Handlers
Learn which handlers are added to the form by default, and how to disable them if necessary.
Removing default handlers
You can remove handlers on a certain action by calling the appropriate method for that action. These methods are:
All of these methods return a list of handlers. Inside the customize method (defined in B25.Form.Customizer), you can directly modify these lists and it will have an effect on the form behavior. For example, to remove all handlers defined on a certain action, you could do the following:
global void customize(B25.Form form) {
// remove all handlers
form.onInit().clear();
}
You can also use the names of the default handlers to identify which ones you want to remove. For example, to remove the default local time setter (triggered when the user opens the form), you can do the following:
global void customize(B25.Form form) {
// copy the list
List<B25.FormEventHandler> clonedList = form.onInit().clone();
// clear the list
form.onInit().clear();
// now add back any handler that is not the local time setter
for (B25.FormEventHandler handler : clonedList) {
if (handler.getName() != 'B25 Local Time Setter') {
form.onInit().add(handler);
}
}
}
Note that the above example is just one way of many to accomplish this goal. A useful reference is the official Apex List class documentation.
List of handlers added by GoMeddo
New Reservation Default Setter
Name: 'B25 New Reservation Default Setter'
Type: Init Handler, included in B25.Form.onInit() .
For new reservations, this handler sets the correct local times. It updates the fields B25__StartLocal__c
and B25__EndLocal__c
.
It also updates the fields B25__Base_Price__c
and B25__Calculation_Method__c
based on whether the reservation is linked to a resource, and that resource has default values for these fields.
Finally, it executes the configured flow to run for new reservations (if configured).
Reservation Type Setting Updater
Name: 'B25 Reservation Type Setting Updater'
Type: Update Handler, included in B25.FormField.onUpdate() for the field B25__Reservation__c.B25__Reservation_Type__c
.
If the Reservation Type changes, this handler updates any buffer fields that need to change (see Buffer Time for an article on this feature).
CurrencyIsoCode Updater
Name: 'B25 CurrencyIsoCode Updater'
Type: Update Handler, included in B25.FormField.onUpdate() for the field B25__Reservation__c.B25__Resource__c
. Only included if the org is multi currency.
If the Resource changes, this handler updates any CurrencyIsoCode fields on the reservation and any related sObjects that are loaded on the form.
Timeframe Time Updater
Name: 'B25 Time Frame Time Updater'
Type: Update Handler, included in B25.FormField.onUpdate() for the field B25__Reservation__c.B25__SelectedTimeframe__c
.
If the user selects a timeframe from the dropdown, this handler updates the reservation times to reflect the chosen timeframe. Configuring timeframes is detailed here: Add Predefined Timeframes
Timeframe Selector
Name: 'B25 Time Frame Selector'
Type: Update Handler, included in B25.FormField.onUpdate() for the fields B25__Reservation__c.B25__StartLocal__c
and B25__Reservation__c.B25__EndLocal__c
.
If the user changes the reservation times, and those times match a timeframe, this handler will update the field B25__Reservation__c.B25__SelectedTimeframe__c
to the matching timeframe. Configuring timeframes is detailed here: Add Predefined Timeframes
SubTotal Update Handler
Name: 'B25 SubTotal Update Handler'
Type: Update Handler, included in B25.FormField.onUpdate() for the field B25__Reservation__c.B25__Subtotal__c
.
If B25__Subtotal__c
changes, this handler updates the B25__Total_Price__c
field to become the sum of B25__Subtotal__c
and B25__Service_Costs__c
.
Service Reservation Subtotal Calculation
Name: 'B25 Service Reservation Subtotal Calculation'