This API creates a direct order without source Id.

API Details

APISignature
CreateOrderRequestwebService static CPQApi.CPQ.CreateOrderResponseDOCreateOrderRequest(CPQApi.CPQ.CreateOrderRequestDO)

Parameters

Name

Type

Description

request

CPQApi.CPQ.CreateOrderRequestDO

     The request data object.

Request Data Object - CPQApi.CPQ.CreateOrderRequestDO

Field

Type

Required?

Description

CustomFields

List<String>

No

List of custom fields on orderSO

OrderInput

Conga_Config2__Order__c

Yes

OrderSO

OrderItems

List<Apttus_CPQApi.CPQ.SelectedProductDO>

No

List of order items

OrderItemSource

String

Yes

Source of order items

Properties

List<Apttus_Config2.Property>

No

List of properties for cart created for order

Request Data Object - CPQApi.CPQ.SelectedProductDO

Field

Type

Required?

Description

AttributeValues

List<Apttus_Config2__ProductAttributeValue__c>

No

Product attribute value for the product

Comments

String

No

Comments

CopyBundleConfigurationFromSource

Boolean

No

For bundles, to copy bundle configuration

CustomData

Apttus_Config2__LineItem__c

No

Custom data line item

CustomFields

List<String>

No

List of custom fields

EndDate

Date

No

End date

ProductId

Id

No

Product Id

Quantity

Decimal

No

Quantity

RelatedLineItems

List<Apttus_Config2__RelatedLineItem__c>

No

List of related line items

SellingTerm

Decimal

No

Selling term

SourceFields

List<String>

No

List of source custom fields to be copied

SourceId

Id

No

Id of a source item

StartDate

Date

No

Start Date

Code Sample

Apttus_CPQApi.CPQ.CreateOrderRequestDO
request = new Apttus_CPQApi.CPQ.CreateOrderRequestDO();


// order item source

request.OrderItemSource = Apttus_CPQApi.CPQ.ITEMSOURCE_QUOTE_LINEITEM;


// create order input

Apttus_Config2_Orderc
inputSO = new Apttus_Config2Order_c();


inputSO.Apttus_Config2_SoldToAccountId_c
= '0014C00000F9Zz3';

inputSO.Apttus_Config2_PriceListId_c
= 'a174C0000001MQ1';

inputSO.Apttus_Config2_PricingDate_c
= Datetime.now();

inputSO.Apttus_Config2_OrderDate_c
= Datetime.now();

inputSO.Apttus_Config2_OrderStartDate_c
= Date.today();

inputSO.Apttus_Config2_OrderEndDate_c
= Date.today().addMonths(12);


inputSO.put('Apttus_QPConfig_ProposalId_c','a0Y4C0000021Cm5');

request.OrderInput = inputSO;

request.CustomFields.add('Apttus_QPConfig_ProposalId_c');


// add order items (optional)

// selected item

Apttus_CPQApi.CPQ.SelectedProductDO productDO = new
Apttus_CPQApi.CPQ.SelectedProductDO(); 

productDO.Comments = 'Test Create Order API';

productDO.CopyBundleConfigurationFromSource = false;

productDO.StartDate = Date.today();

productDO.EndDate = Date.today().addMonths(12);

productDO.SellingTerm = 12;

productDO.Quantity = 1;

productDO.ProductId = '01t4C000001pB1J';


Apttus_Config2_ProductAttributeValuec
attVal = new Apttus_Config2ProductAttributeValue_c();

attVal.RY_Color__c = 'Black';


productDO.AttributeValues.add(attVal);

// productDO.SourceId = 'a0W4C000001MRRF';

request.OrderItems.add(productDO);


// create order

Apttus_CPQApi.CPQ.CreateOrderResponseDO result =
Apttus_CPQApi.CPQWebService.createOrder(request);
CODE