Action Invoker Callback Class
Action Invoker Callback provides you a mechanism to implement custom navigation for custom actions. You can define logic for a custom page to redirect the Sales rep to.
When you click a configured custom action, the system automatically invokes the registered Action Invoker Callback class. The method receives the current cart and action context, and the returned PageReference determines the navigation. If the method returns null, no navigation occurs.
To use the Action Invoker Callback:
Create a custom Apex class that implements the
Apttus_Config2.CustomClass.IActionInvokerCallbackinterface.Register the custom Apex class in Config Custom Classes under Action Invoker Callback Class.
Configure the required custom action in Display Action Settings.
The system invokes the callback automatically when the custom action is clicked. You do not call the method explicitly.
The following methods are available in the Apttus_Config2.CustomClass.IActionInvokerCallback interface.
Method | Signature | Description |
|---|---|---|
invokeAction | System.PageReference invokeAction(Apttus_Config2.ProductConfiguration, Apttus_Config2.CustomClass.ActionParams) | Use this method to implement custom navigation logic when the users click a custom action.
You must return a valid |
Access Cart Information
Use the cart object to access configuration and line item data.
cart.getConfigSO(); // Returns ProductConfiguration__c record
cart.getLineItems(); // Returns related LineItem__c recordsUsing Action Parameters
The system automatically populates the ActionParams object. Do not instantiate or populate it manually.
Commonly used fields include:
ActionName— Name of the clicked custom actionConfigurationId— Current configuration IdAccountId— Related Account IdLineItemIds— Selected line item IdsReturnId— Parent object Id (Opportunity, Quote, and so on)CustomParams— Custom key-value parameters defined in the action configuration
Use these fields to implement conditional navigation logic.
Example
The following sample code shows a basic structure of a custom callback class that implements the IActionInvokerCallback interface. Add your custom logic and return the required PageReference.
global with sharing class DefaultActionInvokerCallback implements Apttus_Config2.CustomClass.IActionInvokerCallback {
/**
* Callback to invoke the custom action
* @param cart the cart object
* @param params the parameters for the action
* @return the result page reference or null if there is no page
*/
global ApexPages.PageReference invokeAction(ProductConfiguration cart, Apttus_Config2.CustomClass.ActionParams params) {
// do nothing
return null;
}
}