This global method enables you to merge duplicate assets automatically.

MethodSignature
mergeAssetsstatic Apttus_Config2.CPQStruct.MergeAssetsResponseDO mergeAssets(Apttus_Config2.CPQStruct.MergeAssetsRequestDO request)


Parameters
NameTypeDescription

Apttus_Config2.CPQStruct.MergeAssetsResponseDO

request

Request object invoked by the method

Request Data Object - Apttus_Config2.CPQStruct.MergeAssetsResponseDO
FieldTypeDescription
AssetIdsList The list of the ID of assets you want to merge.

CartId

ID

The ID of the cart that consists of assets to be incremented.

MergeAssetItemDO

Apttus_Config2.CPQStruct.MergeAssetDO

The merge asset data objects.

Data Object - Apttus_Config2.CPQStruct.MergeAssetDO
FieldTypeDescription

EndDate

Date

The asset end date for merge.

ProductIdIdThe ID of the assets to be merged.
QuantityIntegerThe quantity of the asset.

StartDate

Date 

The asset start date for merge.

Response Parameter - Apttus_Config2.CPQStruct.MergeAssetsResponseDO

FieldTypeDescription
ErrorsListReturns the list of errors if any.

LineItemMap

Map<ID, Apttus_Config2__LineItem__c>

Returns all line items with all their field values.


Code Sample

The following sample enables you to merge a list of assets in a cart.

Apttus_Config2.CPQStruct.MergeAssetsRequestDO request = new Apttus_Config2.CPQStruct.MergeAssetsRequestDO();
for (AssetLineItemWrapperClass record : wrapperAssetLineItemList) 
{
     if (record.selected) 
	 {
        request.AssetIds.add(record.assetId);
     }
}

request.CartId = 'a1I3J000000BKJeUAO';
request.MergeAssetItemDO.startdate = Date.newInstance (2017, 06, 01);

Apttus_Config2.CPQStruct.MergeAssetsResponseDO response = Apttus_Config2.AssetService.mergeAssets(request);
ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, mergeAssets: ' + response)); 
CODE