Splitting Related Line Items
You can use this global method to clone a service line item for each related line item associated with that service line item.
API |
Signature |
---|---|
splitRelatedLineItems |
static Apttus_Config2.CPQStruct.SplitRelatedLineItemResponseDO splitRelatedLineItems(Apttus_Config2.CPQStruct.SplitRelatedLineItemRequestDO requestDO) |
Parameters |
||
---|---|---|
Name |
Type |
Description |
requestDO | Apttus_Config2.CPQStruct.SplitRelatedLineItemRequestDO |
The request data object of related line item details invoked by the method. |
Request Data Object - Apttus_Config2.CPQStruct.SplitRelatedLineItemRequestDO |
||
---|---|---|
Name |
Type |
Description |
CartId | ID |
The ID of the product configuration record. |
Flow | String |
The flow you want to use to validate the split criteria fields. |
LineNumber | Integer |
The Line Number of the service line item you want to split. |
SplitCriteriaFields | List<String> |
List of some or all fields defined in Split Criteria Fields in Config System Properties to be used as criteria to split the service line item. |
Response Data Object - Apttus_Config2.CPQStruct.SplitRelatedLineItemResponseDO |
||
---|---|---|
Field |
Type |
Description |
Errors | List <Strings> |
List of errors encountered while splitting the service line item |
isSuccess | Boolean |
Indicates whether the splitting of service line item was successful. |
Code Sample
The code sample below helps you split a service line item.
public void splitServiceCart(String cartId, String splitCriteriaFieldName)
{
// Prepare the request structure to be passed to the API
Apttus_Config2.CPQStruct.SplitRelatedLineItemRequestDO request = new Apttus_Config2.CPQStruct.SplitRelatedLineItemRequestDO();
request.CartId = cartId;
// Service Line number to split
request.LineNumber = 1;
// this can take OOTB CPQ fields
request.SplitCriteriaFields.add(splitCriteriaFieldName);
// flow to validate the split criteria fields
request.Flow = 'QuotingCartGrid';
// Invoke the API by passing the request formed above
Apttus_Config2.CPQStruct.SplitRelatedLineItemResponseDO responseDO = Apttus_Config2.CPQWebService.splitRelatedLineItems(request);
// Check the response for errors if any
if (!responseDO.IsSuccess) {
System.debug('Errors thrown :');
if (responseDO.Errors != null && responseDO.Errors.size() > 0) {
for (String strError : responseDO.Errors) {
System.debug('\nError - ' + strError);
}
}
}
}