Request Data Object - Apttus_Config2.CPQStruct.RenewAssetsRequestDO
Name
Type
Description
FarthestAssetEndDate
Boolean
Setting this value to true renews assets using the farthest end date.
RenewEndDate
Date
The Asset End Date for Renewal
RenewTerm
Integer
The Renewal Term for an asset
AssetIds
List<ID>
List of asset ids
CartId
ID
The id of Cart for which an asset is being renewed
Response Data Object- Apttus_Config2.CPQStruct.RenewAssetsResponseDO
Field
Type
Description
LineItemMap
Map<ID, Apttus_Config2__LineItem__c>
Returns all line items with all their field values.
Code Sample
The code sample below helps you renew Assets based on the specified Renewal Date or Renewal Term.
// create list of asset ids
List<ID> listAssetId = new List<ID>();
for (AssetLineItemWrapperClass record : wrapperAssetLineItemList)
{
if (record.selected)
{
listAssetId.add(record.assetId);
}
}
// renew assets using an asset line item record with valid Renewal Date and Term
if (objAssetLineItem.Apttus_Config2__RenewalDate__c != null || objAssetLineItem.Apttus_Config2__RenewalTerm__c != null)
{
// create and populate request object
Apttus_Config2.CPQStruct.RenewAssetsRequestDO request = new Apttus_Config2.CPQStruct.RenewAssetsRequestDO();
request.CartId = cartId;
request.AssetIds = listAssetId;
request.RenewEndDate = objAssetLineItem.Apttus_Config2__RenewalDate__c;
request.RenewTerm = objAssetLineItem.Apttus_Config2__RenewalTerm__c;
request.FarthestAssetEndDate = false;
// call renewAssets API
Apttus_Config2.CPQStruct.RenewAssetsResponseDO response = Apttus_Config2.AssetService.renewAssets(request);
ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info,'renewAssets: ' + response));
}