IActionCallback2 class provides a mechanism to apply custom actions on cart finalization, submission for approval using the below Web Services.

  • ActionInvokerWebService.invokeAfterFinalizeCart
  • ActionInvokerWebService.invokeSyncCart
  • ActionInvokerWebService.invokeSyncCartAsync
  • ActionInvokerWebService.invokeFinalizeCart
  • ActionInvokerWebService.invokeFinalizeCartAsync
  • ActionInvokerWebService.invokeAfterSyncCart
  • ActionInvokerWebService.invokeAfterSyncCartAsync
  • ActionInvokerWebService.invokeAfterFinalizeCartAsync
  • ActionInvokerWebService.invokeSubmitApproval
  • ActionInvokerWebService.invokeGenerateDoc

Action callback executes the custom logic from Web Services on the following aspects of CPQ: ‚Äč

  • Finalizing the cart
  • Synchronizing the cart
  • Submitting the cart for approval
  • Generating documents

The following methods are available in the Apttus_Config2.CustomClass.IActionCallback2 interface:

afterFinalizeCart()Boolean afterFinalizeCart(Id)

You can use this method to perform post-finalization tasks on the cart. This method is invoked when you execute the following Web Services:

  • ActionInvokerWebService.invokeAfterFinalizeCart()
  • ActionInvokerWebService.invokeAfterFinalizeCartAsync()
finalizeCart()Boolean finalizeCart(Id)

You can use this method to finalize the cart. This method is invoked when you execute the following Web Services:

  • ActionInvokerWebService.invokeFinalizeCart()
generateDoc()Id generateDoc(Id, Apttus_Config2.CustomClass.ActionParams)

You can use this method to generate documents for the given cart. This method is invoked when you generate documented the following Web Service:

  • ActionInvokerWebService.invokeGenerateDoc()
submitApproval()Boolean submitApproval(Id, Apttus_Config2.CustomClass.ActionParams)You can use this method to submit the cart for approval. This method is invoked when you submit the cart for approval using following the Web Service:
  • ActionInvokerWebService.invokeSubmitApproval()
afterSyncCart()Boolean afterSyncCart(Id)You can use this method to perform post-synchronization tasks on the cart. This method is invoked when the cart is synchronized using the below Web Services:
  • ActionInvokerWebService.invokeSyncCart()
  • ActionInvokerWebService.invokeAfterSyncCartAsync()
syncCart()Boolean syncCart(Id)Tou can use this method to perform to synchronize the cart. This method is invoked when the cart is synchronized synchronously or asynchronously using the below Web Services.
  • ActionInvokerWebService.invokeSyncCart()
  • ActionInvokerWebService.invokeSyncCartAsync()

The following table lists the response parameters of the Apttus_Config2.CustomClass.IActionParamsCallback.

Response Parameters:Apttus_Config2.CustomClass.ActionParams 
AccountIdIdThe ID of the Account.
AccountIdsSet<Id>The set of Account ID you want to use to filter the result. CPQ ignores the AccountId field if this field is used.
ActionNameStringThe name of the action.
ActivateOrderBooleanIndicates whether to activate the order or not.
ApprovalCtxTypeStringThe Context Type of Approval.
ApprovalModeStringThe Mode of Approval
ApprovalReasonStringThe reason of Approval.
ApprovalTypeStringThe type of Approval.
AssetLineItemsList<Apttus_Config2__AssetLineItem__c>The list of asset line items
BundleIdIdThe IDs of the bundle product.
CartIdsList<IDs>The list of cart IDs.
CartSyncModeApttus_Config2.CustomClass.SyncModeThe Sync Mode of the cart. For example, enum SyncMode {SYNC, FINALIZE}.
ConfigurationIdIdThe ID of the configuration in the proposal.
CurrentStateStringThe current state
CustomParamsMap<String, String>The custom parameter that you have defined.
FinalizeClassStringThe callback class that is executed when you finalize the cart.
FlowStringThe flow used in the configuration
IsAngularBooleanIndicates whether the user interface is Angular.
IsDraftBooleanIndicated whether the proposal is in draft stage.
LaunchStateStringThe launch state.
LineItemIdsSet<Id>The set of line item IDs.
LineNumberDecimalThe line number of the products.
LocationIdsSet<Id>The set of location IDs.
MethodStringThe method of configuration.
ModeStringThe mode of the configuration.
OrderLineItemsList<Apttus_Config2__OrderLineItem__c>The list of order line items.
OriginalOrderSOApttus_Config2__Order__cThe Original Order SObject

The output format of the generated document. You can use the following values:

  • PDF
  • DOC
  • RTF
ProductIDsList<IDs>The list of product IDs.

The protection level for the parameters you created.

RequestIdIdThe request ID of the configuration.
ReturnIdIdThe record ID of the business object.
ReturnPageStringThe return page of the business object.
SessionIdStringThe ID of the session.
SessionUrlStringThe URL of the session.
TemplateNameStringThe name of the template in the proposal.


The sample code below enables you to send out the status of the cart to the proposal owner as callback action after finalizing the cart. You can perform post-finalization by calling the Web Service Apttus_Config2. ActionInvokerWebService.invokeAfterFinalizeCart() passing the custom callback class name and the cart ID as parameters.

global with sharing class Apttus_ActionCallback implements Apttus_Config2.CustomClass.IActionCallback2
    global static Boolean finalizeCart(ID cartId) 
		// callback logic to finalize the cart.  This logic will be executed when we call the webservice Apttus_Config2.ActionInvokerWebService.invokeFinalizeCart
        return true;

    global static Boolean afterFinalizeCart(ID cartId)
        // get the owner of the proposal
        Apttus_Config2__ProductConfiguration__c proposalSO = [SELECT Name,Apttus_Config2__Proposald__r.owner.id  
                                                              FROM Apttus_Config2__ProductConfiguration__c 
                                                              WHERE Id =:cartId LIMIT 1];
        // get the email ID of the proposal owner
        Id ownerID = proposalSO.Apttus_Config2__Proposald__r.owner.id;
        User userSO = [SELECT email FROM User WHERE Id =: ownerID LIMIT 1];

        // send finalize action
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setSenderDisplayName('Salesforce Support'); //Sender's Display name
        mail.setSubject('Cart - ' + proposalSO.Name + ' Finalized');
        mail.setPlainTextBody('Please be informed that the cart is finalized.');
        mail.setToAddresses(new List <String> {userSO.email});
        Messaging.sendEmail(new Messaging.SingleEmailmessage[] {mail});

        return true;


    global static Boolean submitApproval(ID cartId, Apttus_Config2.CustomClass.ActionParams params) 
        // callback logic to submit the cart for approval. This method will be executed when we call the WebService Apttus_Config2.ActionInvokerWebService.invokeSubmitApproval
		return true;

    global static ID generateDoc(ID cartId, Apttus_Config2.CustomClass.ActionParams params)
		// callback logic to generate the document for the given the cart. This method will be executed when we call the webserice Apttus_Config2.ActionInvokerWebService.invokeGenerateDoc()
		return null;

    global static Boolean syncCart(ID cartId) 
		// callback logic to synchronize the cart for the given cartId. This method will be executed when we call the webserice Apttus_Config2.ActionInvokerWebService.invokeSyncCart or Apttus_Config2.ActionInvokerWebService.invokeSyncCartAsync
		return true;
	global static Boolean afterSyncCart(ID cartId)
		// callback logic to perform post-synchronization tasks for the given cartId. This method will be executed when we call the webserice Apttus_Config2.ActionInvokerWebService.invokeAfterSyncCart or Apttus_Config2.ActionInvokerWebService.invokeAfterSyncCartAsync
		return true;