Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Info |
---|
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:
Name | Type | Purpose |
---|---|---|
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. |
serviceCosts | Decimal | Contains 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
For a full overview of the Booker25 global classes, methods and properties mentioned on this page:
- Go to Setup
- Search for Apex Classes
- open Util_PluginManager
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:
- Go to Setup
- Search for Custom Settings
- Click Manage next to System Setting
- Click New
- 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
Filter by label (Content by label) | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Page Properties | ||
---|---|---|
| ||
|
Panel | ||
---|---|---|
| ||
|