Adding Options to a Sub Bundle
This API allows you to add one or more option products to the sub-bundle of an existing cart line item. This is typically used in CPQ scenarios where a configurable product (bundle) has nested configurations (sub-bundles) and additional components or features need to be dynamically added.
|
API |
Signature |
|---|---|
| addOptionsToSubBundle |
webService static Apttus_CPQApi.CPQ.AddOptionsResponseDO addOptionsToSubBundle(Id cartId, Integer primaryLineNumber, List selectedOptions) |
|
Request Parameters | ||
|---|---|---|
|
Name |
Type |
Description |
| CartID | ID |
The cart ID |
| PrimaryLineNumber | Integer |
Line Number of the Sub Bundle Product |
| selectedOptions | List<Apttus_CPQApi.CPQ.SelectedOptionDO> |
Apttus_CPQApi CPQ.SelectedOptionDO with componentId and componentProductId |
|
Data Object - Apttus_CPQApi.CPQ.SelectedOptionDO | ||
|---|---|---|
|
Field |
Type |
Description |
| AttributeValues | List |
List of attributes values. |
| AssetId | List | Asset Id |
| Quantity | Decimal | The product quantity |
| Comments | String |
Comments associated with the record. |
| ComponentId | ID |
Id of the component. |
| ComponentProductId | ID |
Id of the component product. |
| CustomData | Apttus_Config2__LineItem__c |
The values to be set for the custom fields in the CustomFields List |
| CustomFields | List<String> |
List of Custom Field’s API Name |
| EndDate | Date |
The end date. |
| Quantity | Decimal |
The option quantity. |
| SellingTerm | Decimal |
The option selling term. |
| SourceId | ID |
ID of the source option. |
| StartDate | Date |
The start date. You should ensure you use the correct date format. |
| Response : Apttus_CPQApi.CPQ.CreateCartResponseDO | ||
|---|---|---|
| Name | Type | Description |
| CartId | ID | The identifier of the cart |
| RequestId | ID | Request ID |
Code Sample
The sample code below creates an option and adds them to the specified bundle in the specified cart.Id cartId = 'a01XXXXXXXXXXXX'; // Replace with your Cart Id
Integer primaryLineNumber = 1; // Replace with your sub-bundle's primary line number
// Prepare selected options
List<CPQ.SelectedOptionDO> selectedOptions = new List<CPQ.SelectedOptionDO>();
CPQ.SelectedOptionDO option1 = new CPQ.SelectedOptionDO();
option1.ComponentId = 'a0BXXXXXXXXXXXX'; // Replace with a valid Component Id
option1.ComponentProductId = '01tXXXXXXXXXXXX'; // Replace with a valid Product Id
option1.Quantity = 1;
selectedOptions.add(option1);
// Add more options as needed...
// Call the web service method
CPQ.AddOptionsResponseDO response = CPQWebService.addOptionsToSubBundle(
cartId,
primaryLineNumber,
selectedOptions
);
// Debug the response
System.debug('Added Option Line Items: ' + response.addedOptionLineItems);
Integration Details
Use the following information in your integrations with CPQ Web Services API. Refer to Integrating Conga with External Systems for information on how to get started.
