Conga Product Documentation

Welcome to the new doc site. Some of your old bookmarks will no longer work. Please use the search bar to find your desired topic.

Show Page Sections

download

Creating a Cart for an Order

This API creates a cart for the order referenced by OrderId.

API Details

API

Signature

createCart

webService static Conga_Config2.CPQStruct.CreateCartResponseDO createCart(Apttus_Config2.CPQStruct.CreateCartRequestDO)

Parameters

Name

Type

Description

request

CPQStruct.CreateCartRequestDO

The request data object.

Request Data Object - CPQStruct.CreateCartRequestDO

Field

Type

Required?

Description

OrderId

ID

Yes

The Id of the order to be associated with the cart.

Properties

List<Config2.Property>

No

The list of properties applicable to the cart.

Data Object - Config2.Property

Field

Type

Required?

Description

Name

String

Yes

Specify the features applicable to the cart. Applicable values are:
  • useAdvancedApproval: Enables Advanced Approval for a cart.
  • useDealOptimizer: Enables Deal Optimizer for a cart.

Value

String

No

The applicable values are true or false. Specifying the value as true enables the feature for a cart.

API Response

Response Data Object - CPQStruct.CreateCartResponseDO

Field

Type

Description

CartId

ID

The Id of the newly created cart object.

Code Sample

The following code sample enables you to create a cart for a valid order with an Order Id. Using the sample, you can search for a valid order using an order number. If an order exists with the order number entered, you can create a cart using createCart(). You can invoke this API in use cases when you want to show a cart page based on the order.

public void createCart()
{
	if(String.isNotBlank(orderId))
	{
		// Create config properties
		List<Apttus_Config2.Property> configProps = new List<Apttus_Config2.Property>();
		
		Apttus_Config2.Property prop = new Apttus_Config2.Property();
		
		prop.Name = 'useAdvancedApproval';
		prop.Value = 'false';
		configProps.add(prop);
		
		prop = new Apttus_Config2.Property();
		prop.Name = 'useDealOptimizer';
		prop.Value = 'false';
		configProps.add(prop);
		
		// Create the request
		Apttus_Config2.CPQStruct.CreateCartRequestDO request = new Apttus_Config2.CPQStruct.CreateCartRequestDO();
		
		// Add request parameters
		request.OrderId = orderId;
		request.Properties.addAll(configProps);
   
		// Create a new cart for Order
		Apttus_Config2.CPQStruct.CreateCartResponseDO result = Apttus_Config2.OrderWebService.createCart(request);
		
		// Get the cart Id
		cartId = result.CartId;
	} else {
		ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, 'Invalid or Blank Order Id.'));
	}
}

API Prerequisites

None.

Request and Response XML

Example Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ord="http://soap.sforce.com/schemas/class/Apttus_Config2/OrderWebService" xmlns:cpq="http://soap.sforce.com/schemas/class/Apttus_Config2/CPQStruct">
   <soapenv:Header>
            <ord:SessionHeader>
         <ord:sessionId>00D7A0000009QII!ARUAQFmpeBOmsYS2JcADxYc4PxWoOkAHJP1JiNo5vtvnDBCEvfnWWWmO7pqbEXY7WadiCmm_Vib6MjhmgUbR8321tIO1NQRg</ord:sessionId>
      </ord:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <ord:createCart>
         <ord:request>
            <!--Optional:-->
            <cpq:OrderId>a2n7A0000002tviQAA</cpq:OrderId>
         </ord:request>
      </ord:createCart>
   </soapenv:Body>
</soapenv:Envelope>

Example Response

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/schemas/class/Apttus_Config2/OrderWebService" xmlns:CreateCartResponseDO="http://soap.sforce.com/schemas/class/Apttus_Config2/CPQStruct">
   <soapenv:Body>
      <createCartResponse>
         <result>
            <CreateCartResponseDO:CartId>a1I7A000001IqcfUAC</CreateCartResponseDO:CartId>
         </result>
      </createCartResponse>
   </soapenv:Body>
</soapenv:Envelope>