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 |
|
The ID of the Account. |
AccountIds |
|
The set of Account ID you want to use to filter the result. CPQ ignores the AccountId field if this field is used. |
ActionName |
|
The name of the action. |
ActivateOrder |
|
Indicates whether to activate the order or not. |
ApprovalCtxType |
|
The Context Type of Approval. |
ApprovalMode |
|
The Mode of Approval |
ApprovalReason |
|
The reason of Approval. |
ApprovalType |
|
The type of Approval. |
AssetLineItems |
|
The list of asset line items |
BundleId |
|
The IDs of the bundle product. |
CartIds |
|
The list of cart IDs. |
CartSyncMode |
|
The Sync Mode of the cart. For example, enum SyncMode {SYNC, FINALIZE}. |
ConfigurationId |
|
The ID of the configuration in the proposal. |
CurrentState |
|
The current state |
CustomParams |
|
The custom parameter that you have defined. |
FinalizeClass |
|
The callback class that is executed when you finalize the cart. |
Flow |
|
The flow used in the configuration |
IsAngular |
|
Indicates whether the user interface is Angular. |
IsDraft |
|
Indicated whether the proposal is in draft stage. |
LaunchState |
|
The launch state. |
LineItemIds |
|
The set of line item IDs. |
LineNumber |
|
The line number of the products. |
LocationIds |
|
The set of location IDs. |
Method |
|
The method of configuration. |
Mode |
|
The mode of the configuration. |
OrderLineItems |
|
The list of order line items. |
OriginalOrderSO |
|
The Original Order SObject |
OutputFormat |
|
The output format of the generated document. You can use the following values:
|
ProductIDs |
|
The list of product IDs. |
ProtectionLevel |
|
The protection level for the parameters you created. |
RequestId |
|
The request ID of the configuration. |
ReturnId |
|
The record ID of the business object. |
ReturnPage |
|
The return page of the business object. |
SessionId |
|
The ID of the session. |
SessionUrl |
|
The URL of the session. |
TemplateName |
|
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;
}
}