Request Data Object - Apttus_CPQApi.CPQ.AddMiscItemRequestDO
Field
Type
Description
AllocateGroupAdjustment
Boolean
Indicates whether group adjustment should be allocated.
AllowRemoval
Boolean
Indicates whether removing the miscellaneous item is allowed.
Amount
Decimal
The Base Price for the miscellaneous item.
CartId
Id
The id of the cart where you want to add the miscellaneous item.
ChargeType
String
The charge type of the miscellaneous item.
Description
String
Description of the miscellaneous item.
Response Data Object - Apttus_CPQApi.CPQ.AddMiscItemResponseDO
Field
Type
Description
MiscItem
Apttus_Config2__LineItem__c
The miscellaneous item that is created.
Code Sample
The sample code below enables you to add a miscellaneous item to a cart by passing proposal, charge type, description, and base amount.
/**
* The below method demonstrates how to add a misc to an existing cart (every quote has a cart)
* Let’s assume that the quote cart is already added Laptop as a bundle product and its two options are Keyboard and Mouse.
* Inside this method, we will add delivery charge as misc item to the cart.
*/
public Apttus_CPQApi.CPQ.AddMiscItemResponseDO addMiscItem(String proposalName, String chargeType, String description, Decimal amount)
{
Apttus_Config2__ProductConfiguration__c cart = [SELECT Id
FROM Apttus_Config2__ProductConfiguration__c
WHERE Apttus_QPConfig__Proposald__r.Name = :proposalName LIMIT 1];
// Create the request object
Apttus_CPQApi.CPQ.AddMiscItemRequestDO request = new Apttus_CPQApi.CPQ.AddMiscItemRequestDO();
// add misc attributes to the request
request.CartId = cart.Id;
request.ChargeType = ChargeType;
request.Description = Description;
request.Amount = amount;
request.AllocateGroupAdjustment = true;
request.AllowRemoval = true;
// create the response object
Apttus_CPQApi.CPQ.AddMiscItemResponseDO response = Apttus_CPQApi.CPQWebService.addMiscItem(request);
return response;
}