Creating a Direct Order
This API creates a direct order without source Id.
API Details
|
API |
Signature |
|---|---|
|
CreateOrderRequest |
|
|
Parameters |
||
|---|---|---|
|
Name |
Type |
Description |
|
request |
|
The request data object. |
|
Request Data Object - CPQApi.CPQ.CreateOrderRequestDO |
|||
|---|---|---|---|
|
Field |
Type |
Required? |
Description |
|
CustomFields |
|
No |
List of custom fields on orderSO |
|
OrderInput |
|
Yes |
OrderSO |
|
OrderItems |
|
No |
List of order items |
|
OrderItemSource |
|
Yes |
Source of order items |
|
Properties |
|
No |
List of properties for cart created for order |
|
Request Data Object - CPQApi.CPQ.SelectedProductDO |
|||
|---|---|---|---|
|
Field |
Type |
Required? |
Description |
|
AttributeValues |
|
No |
Product attribute value for the product |
|
Comments |
|
No |
Comments |
|
CopyBundleConfigurationFromSource |
|
No |
For bundles, to copy bundle configuration |
|
CustomData |
|
No |
Custom data line item |
|
CustomFields |
|
No |
List of custom fields |
|
EndDate |
|
No |
End date |
|
ProductId |
|
No |
Product Id |
|
Quantity |
|
No |
Quantity |
|
RelatedLineItems |
|
No |
List of related line items |
|
SellingTerm |
|
No |
Selling term |
|
SourceFields |
|
No |
List of source custom fields to be copied |
|
SourceId |
|
No |
Id of a source item |
|
StartDate |
|
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);
