Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

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:

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 Booker25

Init Handler: Local Time Setter

Name: 'B25 Local Time 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.

  • No labels