Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt |
---|
Booker25 adds some default handlers to the form. This page details which ones, what they do, and how you can 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:
Code Block |
---|
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:
Code Block |
---|
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);
}
}
} |
Info |
---|
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
Init Handler: 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).
Update Handler: 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).
Update Handler: 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
.
Update Handler: 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.
Add Handler: 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.
On this page | |
---|---|
|