Download PDF
Download page IActionCallback2 Interface.
IActionCallback2 Interface
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:
Method | Signature | Description |
---|---|---|
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:
|
finalizeCart() | Boolean finalizeCart(Id) | You can use this method to finalize the cart. This method is invoked when you execute the following Web Services:
|
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:
|
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:
|
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:
|
syncCart() | Boolean syncCart(Id) | You 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.
|
The following table lists the response parameters of the Apttus_Config2.CustomClass.IActionParamsCallback.
Response Parameters:Apttus_Config2.CustomClass.ActionParams | ||
---|---|---|
Name | Type | Description |
AccountId | Id | The ID of the Account. |
AccountIds | Set<Id> | The set of Account ID you want to use to filter the result. CPQ ignores the AccountId field if this field is used. |
ActionName | String | The name of the action. |
ActivateOrder | Boolean | Indicates whether to activate the order or not. |
ApprovalCtxType | String | The Context Type of Approval. |
ApprovalMode | String | The Mode of Approval |
ApprovalReason | String | The reason of Approval. |
ApprovalType | String | The type of Approval. |
AssetLineItems | List<Apttus_Config2__AssetLineItem__c> | The list of asset line items |
BundleId | Id | The IDs of the bundle product. |
CartIds | List<IDs> | The list of cart IDs. |
CartSyncMode | Apttus_Config2.CustomClass.SyncMode | The Sync Mode of the cart. For example, enum SyncMode {SYNC, FINALIZE}. |
ConfigurationId | Id | The ID of the configuration in the proposal. |
CurrentState | String | The current state |
CustomParams | Map<String, String> | The custom parameter that you have defined. |
FinalizeClass | String | The callback class that is executed when you finalize the cart. |
Flow | String | The flow used in the configuration |
IsAngular | Boolean | Indicates whether the user interface is Angular. |
IsDraft | Boolean | Indicated whether the proposal is in draft stage. |
LaunchState | String | The launch state. |
LineItemIds | Set<Id> | The set of line item IDs. |
LineNumber | Decimal | The line number of the products. |
LocationIds | Set<Id> | The set of location IDs. |
Method | String | The method of configuration. |
Mode | String | The mode of the configuration. |
OrderLineItems | List<Apttus_Config2__OrderLineItem__c> | The list of order line items. |
OriginalOrderSO | Apttus_Config2__Order__c | The Original Order SObject |
OutputFormat | String | The output format of the generated document. You can use the following values:
|
ProductIDs | List<IDs> | The list of product IDs. |
ProtectionLevel | String | The protection level for the parameters you created. |
RequestId | Id | The request ID of the configuration. |
ReturnId | Id | The record ID of the business object. |
ReturnPage | String | The return page of the business object. |
SessionId | String | The ID of the session. |
SessionUrl | String | The URL of the session. |
TemplateName | String | The name of the template in the proposal. |
Example
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.setSaveAsActivity(true);
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;
}
}