Adjustment Spread Callback provides you a mechanism to restrict adjustment spread amount on option line items.
To use the Adjustment Spread Callback you must create a custom Apex class that implements the Apttus_Config2.CustomClass.IAdjustmentSpreadCallback interface and register the custom apex class with Adjustment Spread Callback Class. You must write your custom logic in the custom apex class.
The following methods are available in the Apttus_Config2.CustomClass.IAdjustmentSpreadCallback interface:
Method
Signature
Description
finish()
void finish()
This the last method that is executed after the callback is invoked.
spreadBundleAdjustment()
List spreadBundleAdjustment(Apttus_Config2.LineItem, List)
You can use this method to restrict the adjustment spread amount on options from the Bundle line adjustment.
spreadGroupAdjustment()
List spreadGroupAdjustment(Apttus_Config2.SummaryGroup, List, Map>)
You can use this method to restrict the adjustment spread amount on options from the summary group adjustment.
start()
void start(Apttus_Config2.ProductConfiguration)
This is the first method that is executed when the callback is invoked.
Example
The given code example implements both methods to restrict the adjustment spread values of option line items.
global with sharing class RG_AdjustmentSpreadCallback implements Apttus_Config2.CustomClass.IAdjustmentSpreadCallback
{
private static Apttus_Config2__ProductConfiguration__c config;
global static void start(Apttus_config2.ProductConfiguration cart)
{
config = cart.getConfigSO();
}
global static List<Apttus_config2.LineItem> spreadGroupAdjustment(Apttus_config2.SummaryGroup parentGroup, List<Apttus_config2.LineItem> childLineItems, Map<ID, List<Apttus_config2.LineItem>> optionItemsByBundleId)
{
List<Apttus_config2.LineItem> lines;
if(config.Price_list_name__c== 'Auto Pricing Call Back Pricelist2')
{
ID lineId = childLineItems.get(0).getLineItemSO().ID;
lines = optionItemsByBundleId.get(lineId);
for (Apttus_config2.LineItem optionLineItem : lines)
{
//Below line use to restrict adjustment spread amount on option line items.
optionLineItem.getLineItemSO().Apttus_Config2__AdjustmentAmount__c = 7.99999;
}
}
return lines;
}
global static List<Apttus_config2.LineItem> spreadBundleAdjustment(Apttus_config2.LineItem parentItem, List<Apttus_config2.LineItem> optionItems)
{
for(Apttus_Config2.LineItem OI: optionItems)
{
if(config.Price_list_name__c== 'Auto Pricing Call Back Pricelist')
{
Apttus_Config2__LineItem__c item = OI.getLineItemSO();
//Below line use to restrict adjustment spread amount on option line items.
item.Apttus_Config2__AdjustmentAmount__c = 8.99999;
}
}
return optionItems;
}
}