Default Handlers

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:

1 2 3 4 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:

1 2 3 4 5 6 7 8 9 10 11 12 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 Booker25

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 https://gen25-jira.atlassian.net/wiki/spaces/BPD/pages/2018770945 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: https://gen25-jira.atlassian.net/wiki/spaces/BPD/pages/1342799873


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: https://gen25-jira.atlassian.net/wiki/spaces/BPD/pages/1342799873


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'

Type: Update Handler, included in B25.FormField.onUpdate() for the fields B25__Service_Reservation__c.B25__Quantity__c and B25__Service_Reservation__c.B25__Unit_Price__c.

If either the quantity or the unit price changes on a service reservation, this handler updates the B25__Subtotal__c field on that record to the value: Quantity * Unit Price.


Service Reservation Added Price Defaults

Name: 'B25 Service Reservation Added Price Defaults'

Type: Add Handler, included in B25.RelatedList.onAdd() for the related list B25__Service_Reservation__c.

When a new service reservation is added to the list, this handler sets a few default values:

  • It sets the field B25__Unit_Price__c to the price of the selected service.

  • It sets the field B25__Quantity__c to the default quantity of the selected service, or if that is null, the quantity of the reservation itself.

  • It sets the field B25__Subtotal__c to the value: Quantity * Unit Price.


Name: 'B25 <name of related list sObject> CurrencyIsoCode Setter';

Type: Add Handler, included in B25.RelatedList.onAdd() for the related list B25__Service_Reservation__c and dimension junctions. Only included if the org is multi currency.

When a new sObject is added to the list, this handler sets the CurrencyIsoCode field to the CurrencyIsoCode field value of the reservation.