After you add a line item to a cart, this API enables you to add primary and secondary ramp line items for the line item. Once the ramp line items are created, you can also update the ramp line item details or delete ramp line item details using standard SOQL queries.

When you use Apttus CPQ out of the box, invoke the ramp using the red icon to the left of the primary line item.


Once you click the ramp icon, the ramp dialog appears:


The ramp dialog allows you to add, edit dates and quantity, make adjustments, save the changes, and cancel the changes.

Once the customer adds a ramp to a cart line item, they can do the following:

  • Edit the start date, end date, quantity, adjustment type and adjustment amount based on the custom setting.

  • The start date of a ramp line item defaults to the end date+1 of the previous line item.

  • The end date of a ramp line item defaults to a date such that the difference between the start date and end date is the same as that of the previous line item.

  • The user can add more ramp line items after or in between the ramp line items.

  • The user can remove the new line before saving by clicking on the icon in the right most column.

Use the addMultiProducts API to add products to the cart.

This API adds one or more products (with default options) to the cart along with quantity, term, start date, and end date.


APISignature
addMultiProductswebService static Apttus_CPQApi.CPQ.AddMultiProductResponseDO addMultiProducts(Apttus_CPQApi.CPQ.AddMultiProductRequestDO request)
Parameters
NameTypeDescription
requestApttus_CPQApi.CPQ.AddMultiProduct RequestDOThe request data object.
Request Data Object - Apttus_CPQApi.CPQ.AddMultiProductRequestDO
FieldTypeDescription
CartIdIDThe Id of the cart.
SelectedProductsList <Apttus_CPQApi.CPQ.SelectedProductDO>The list of selected product data objects.
Data Object - Apttus_CPQApi.CPQ.SelectedProductDO
FieldTypeDescription
AttributeValuesListList of attributes values.
CommentsStringComments associated with the record.
CopyBundleConfigurationFromSourceBooleanYou can use this to copy the configuration of the bundle from the source
CustomDataApttus_Config2__LineItem__cThis can be used to include the list of custom fields you have added to the product.
CustomFields

List<String> CustomFields

List of custom fields created for your product.
EndDateDateThe end date.
ProductIdIDId of the product bundle.
QuantityDecimalThe bundle quantity.
RelatedLineItemsListList of related line items for bundle
SellingTermDecimalThe bundle selling term.
SourceFieldsListList of the fields in the source bundle that you want to copy.
SourceIdIDID of the source bundle.
StartDateDateThe start date. You should ensure you use the correct date format.
Response Data Object - Apttus_CPQApi.CPQ.AddMultiProductResponseDO
FieldTypeDescription
LineNumbersList<Decimal>The list of line numbers added to the cart.


Code Sample

The sample below enables you to add ramp line items after you have:

  • Added Products to the cart using the AddMultiProducts APIs,
  • Updated the Price for the added products using the updatePriceforCart API.
  • Selected the products for which you want to add a ramp for.

Using the sample below you fetch the list of selected products for which you want to add a ramp. You also fetch the parameters for each of the selected products. For all the ramps you create, set PriceGroup as Price Ramp and PricingStatus as Pending. For a primary line item, set IsPrimaryLine__c = true, IsPrimaryRampLine__c = true, and PrimaryLineNumber__c = 1.


public void createRampLineItems()
{
	List<String> rampLineItems = new List<String>();
	
	if(lstWrapItems.size() > 0)
	{
		// Create a list of selected products for which you want to create a ramp for
		for(LineItemWrapperClass objLineItemWrapperClass : lstWrapItems) 
		{
			if(objLineItemWrapperClass.Selected)
			{
				rampLineItems.add(objLineItemWrapperClass.Name);
			}
		}
		
		// Sort Ramp Line Items by name
		rampLineItems.sort();
		
		Integer rampLineItemIndex = 1;
		
		for(String rampLineItemName : rampLineItems)
		{
			// Get Line Item parameters for the selected products
			Apttus_Config2__LineItem__c lineItem = [SELECT Apttus_Config2__ItemSequence__c, Apttus_Config2__PricingStatus__c, Apttus_Config2__PriceGroup__c, 
			Apttus_Config2__IsPrimaryRampLine__c, Apttus_Config2__IsPrimaryLine__c, Apttus_Config2__LineNumber__c, Apttus_Config2__PrimaryLineNumber__c from Apttus_Config2__LineItem__c WHERE 
			Name=:rampLineItemName];
			
			//Set the parameters for each of the line items
			lineItem.Apttus_Config2__PriceGroup__c = 'Price Ramp';
			lineItem.Apttus_Config2__PricingStatus__c = 'Pending';
			lineItem.Apttus_Config2__LineNumber__c = 1;
			lineItem.Apttus_Config2__PrimaryLineNumber__c = 1;
			lineItem.Apttus_Config2__ItemSequence__c = rampLineItemIndex;
			
			//For a primary line item set the following
		`	if(rampLineItemIndex == 1)
			{
				lineItem.Apttus_Config2__IsPrimaryLine__c = true;
				lineItem.Apttus_Config2__IsPrimaryRampLine__c = true;
			}
			
			//For all secondary line items set the following parameters
			else
			{
				lineItem.Apttus_Config2__IsPrimaryLine__c = false;
				lineItem.Apttus_Config2__IsPrimaryRampLine__c = false;
			}
			
			// Update Line Items
			update lineItem;
			
			rampLineItemIndex++;
        }
    }
        else
        {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, 'No line items available.'));
        }
}
CODE