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 11 Next »

In order keep configuration simple, please perform the following steps in Salesforce Classic (Booker25 is Lightning-Ready, you may afterwards use the app in Salesforce Lightning as you please)


Use the following procedure to define custom price calculations on resources and services.

1. Create your custom price calculator class

Create a class that implements the interface B25.Util_PluginManager.ReservationPrice. Implementing that interface means the class must have a method with the following signature:

void calculate(B25.Util_PluginManager.ReservationPriceData)

This method will be called whenever a reservation is saved, or whenever the reservation form gets rerendered. You can control when the reservation form gets rerendered, more on that in a bit. The B25.Util_PluginManager.ReservationPriceData object that gets passed along to the calculate method has two properties that will help you to make your own price calculation.
NameTypePurpose

reservation

B25__Reservation__c
Contains the service costs as shown on the reservation form when you have the setting 'Services have a price' enabled. [link to other doc page] Go here for more information about configuring Booker25's system settings.
serviceCostsDecimalContains the reservation as it is at the moment the calculate method is called. It will have all the fields populated that are visible on the reservation form.

In the calculate method you will be able to set any fields on the reservation property record, such as the B25__Subtotal__c field, in order to control the final price of the reservation, or to start an approval process.


For code samples of various use cases for the price calculator class, go here. You will also find the default price calculation code that Booker25 executes when you don't use a custom price calculator class. [pagina maken met wat code samples? daar moeten we eigenlijk ook wat zeggen over het bulkifyen van de class]

For the official documentation on how to write classes and how to implement interfaces go to: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes.htm

Booker25 Global Classes

For a full overview of the Booker25 global classes, methods and properties mentioned on this page:
  1. Go to Setup
  2. Search for Apex Classes
  3. Open the Util_PluginManager class

2. Activate the custom price calculator class

After completing step 1, you will need to let Booker25 know that it should use your custom class instead of the default price calculation [wederom ergens linken naar default code die uitgevoerd wordt?]

To do this:
  1. Go to Setup
  2. Search for Custom Settings
  3. Click Manage next to System Setting
  4. Click New
  5. Name the record Reservation Price Calculator Class, and for String Value enter the name of your custom price calculator class

As long as this setting exists, Booker25 will execute the calculate method every time the reservation form gets rerendered or when the reservation is saved.

Related articles

On this page

  • No labels