Merging Duplicate Assets
This global method enables you to merge duplicate assets automatically.
|
Method |
Signature |
|---|---|
| mergeAssets |
static Apttus_Config2.CPQStruct.MergeAssetsResponseDO mergeAssets(Apttus_Config2.CPQStruct.MergeAssetsRequestDO request) |
|
Parameters |
||
|---|---|---|
|
Name |
Type |
Description |
| Apttus_Config2.CPQStruct.MergeAssetsResponseDO | request |
Request object invoked by the method |
|
Request Data Object - Apttus_Config2.CPQStruct.MergeAssetsResponseDO |
||
|---|---|---|
|
Field |
Type |
Description |
| AssetIds | List |
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 |
||
|---|---|---|
|
Field |
Type |
Description |
| EndDate | Date |
The asset end date for merge. |
| ProductId | Id |
The ID of the assets to be merged. |
| Quantity | Integer |
The quantity of the asset. |
| StartDate | Date |
The asset start date for merge. |
|
Response Parameter - Apttus_Config2.CPQStruct.MergeAssetsResponseDO |
||
|---|---|---|
|
Field |
Type |
Description |
| Errors | List |
Returns 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));
