This API creates and assigns a miscellaneous item to the cart.

APISignature
addMiscItemwebService static Apttus_CPQApi.CPQ.AddMiscItemResponseDO addMiscItem(Apttus_CPQApi.CPQ.AddMiscItemRequestDO request)



Parameters
NameTypeDescription
requestApttus_CPQApi.CPQ.AddMiscItemRequestDOThis is the request data object.



Request Data Object - Apttus_CPQApi.CPQ.AddMiscItemRequestDO
FieldTypeDescription
AllocateGroupAdjustmentBooleanIndicates whether group adjustment should be allocated.
AllowRemovalBooleanIndicates whether removing the miscellaneous item is allowed.
AmountDecimal The Base Price for the miscellaneous item.
CartIdIdThe id of the cart where you want to add the miscellaneous item.
ChargeTypeStringThe charge type of the miscellaneous item.
DescriptionString Description of the miscellaneous item.



Response Data Object - Apttus_CPQApi.CPQ.AddMiscItemResponseDO
FieldTypeDescription
MiscItemApttus_Config2__LineItem__cThe 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;
}
 
CODE