You can add your own custom buttons to the Reservation form on the calendar. These buttons can reference a VisualForce page and its controller to perform any kind of logic on existing Reservations.
You can also define a custom Apex class to perform actions on the Reservation without leaving the Reservation Form.
For the sake of this tutorial, we will assume that you have already created the VisualForce page that will perform logic on the reservation |
This button will now be added to the reservation form. On click, it will perform the logic in the VisualForce page's controller on the reservation record.
For the sake of this tutorial, we will assume that you have already created the VisualForce page that will perform logic on the reservation |
This button will now be added to the Reservation Form. On click, it will perform the logic in the Apex class and update the form according to any changes made.
Users will only see the button if they have access to the specified Apex class |
The SObjects passed to this method are the SObjects used to render the form and save the data to the database. Any changes made to the objects are propagated to the Reservation Form. If any errors are thrown in the implementation on update, they are shown to the user as a page message. However a failed update does not update the Reservation Form back to its original values, that is the responsibility of the implementation. |
The B25.ExecutableCustomButton requires you to implement one method public void execute(B25.ExecutableCustomButtonContext context).
This method is called when the user clicks the button on the Reservation Form.
The ExecutableCustomButtonContext object contains the following data:
Type | Name | Description |
---|---|---|
B25__Reservation__c | reservation | The Reservation open on the Reservation Form |
Boolean | isRecurring | If the Reservation is recurring |
B25__Recurring_Reservation__c | recurringReservation | The Recurring Reservation object that belongs to the recurring series of this Reservation, if the Reservation is recurring |
Map<String, List<SObject>> | dimensionJunctions | A map of any Dimension Junction objects. Mapped by the API name of the Dimension Junction Object |
List<B25__Service_Reservation__c> | serviceReservations | The ServiceReservation currently on the form |
Below is a sample implementation that moves the Reservation forward by one hour. It updates both the B25__StartLocal__c and B25__Start__c fields, as otherwise a 'time mismatch error' may occur.
global with sharing class SampleImplementation implements B25.ExecutableCustomButton { public void execute(B25.ExecutableCustomButtonContext context) { context.reservation.B25__StartLocal__c = context.reservation.B25__StartLocal__c.addHours(1); context.reservation.B25__EndLocal__c = context.reservation.B25__EndLocal__c.addHours(1); context.reservation.B25__Start__c = context.reservation.B25__Start__c.addHours(1); context.reservation.B25__End__c = context.reservation.B25__End__c.addHours(1); Database.update(context.reservation); } } |
Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.
|