You are here:
Customize the MarginRangeLoader Interface Implementation
If you do not want to use a Vlocity calculation procedure to calculate your margin ranges, you can create a new one, name it in the pricing plan step, and build custom logic to load the margin range.
This step is optional. Skip it if you want to use Salesforce's default MarginRangeLoader interface implementation.
Name |
Properties |
|---|---|
Interface Name |
MarginRangeLoader |
Active Implementation Class |
DefaultMarginRangeLoaderImplementation |
Purpose |
Introduced in the Winter '19 release, this interface implementation loads the margin range data from a Vlocity calculation procedure and returns the data in an output map. You can pass the calculation procedure name, loadMarginRange, through the pricing plan step. |
-
Specify your input and output parameters.
Input /Output Data Key
Data Type
Description
Input Parameters
parent
sObject
For order, opportunity, or quote
lineItemList
List<sObject>
For orderItem, opportunityLineItem, or quoteLineItem
Output Parameters
matrix Output
Map <Id, Map<String, Decimal>
ID is lineItemID
For line item id, you need to pass the Map<String, Decimal> map. The following keys are expected:
-
One Time Margin Lower Bound
-
One Time Margin Upper Bound
-
Recurring Margin Lower Bound
-
Recurring Margin Upper Bound
-
-
Use the following sample code to customize the margin range interface
implementation.
global class SampleMarginRangeLoaderImplementation implements vlocity_cmt.VlocityOpenInterface { global Boolean invokeMethod(String methodName, Map<String, Object> input, Map<String, Object> output, Map<String, Object> options) { if (methodName.equals('loadMarginRanges')) { loadMarginRanges(input, output, options); return true; } return false; } private void loadMarginRanges(Map<String, Object> input, Map<String, Object> output, Map<String, Object> options) { //write your own logic } }

