Display Action Callback provides you a mechanism to disable any of the action buttons on the cart. Following are few examples of custom buttons that you can disable:
Abandon
Approvals
Generate
Quick Save
To use the Display Action Callback you must create a custom Apex class that implements the Apttus_Config2.CustomClass.IDisplayActionCallback interface and register the custom apex class with Display Action Callback Class. You must write your custom logic in the custom apex class.
The following methods are available in the Apttus_Config2.CustomClass.IDisplayActionCallback interface:
This is the first method that is executed when the callback is invoked.
Example
This is just a sample callback custom class to hide the visibility of the Abandon and Generate action buttons on the cart page. You may change the custom class to fit your business requirements
global with sharing class SampleDisplayActionCallback implements Apttus_Config2.CustomClass.IDisplayActionCallback{
List<Apttus_Config2.DisplayActionInfo> displayActions;
global void start(Apttus_Config2.ProductConfiguration cart, List<Apttus_Config2.DisplayActionInfo>displayActions){
this.displayActions = displayActions;
}
global void setActionProperties(Apttus_Config2.CustomClass.ActionParams actionParam){
for (apttus_config2.DisplayActionInfo action : displayActions) {
if(action.ActionSO.Apttus_Config2__ActionName__c == 'Abandon'){
action.isEnabled = false;
}
if (action.ActionSO.Apttus_Config2__ActionName__c == 'Generate'){
action.isEnabled = false;
}
}
}
}