You can use this global method to clone a service line item for each related line item associated with that service line item.

APISignature
splitRelatedLineItemsstatic 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.

FlowStringThe flow you want to use to validate the split criteria fields.
LineNumberIntegerThe Line Number of the service line item you want to split.
SplitCriteriaFieldsList<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

ErrorsList <Strings>List of errors encountered while splitting the service line item
isSuccessBooleanIndicates 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);
			}
		}
	}
}
CODE