You can invoke this global method to suspend assets. You can process a maximum of 200 line items in each Suspend API call.

APISignature
suspendAssetsstatic Apttus_Config2.CPQStruct.SuspendAssetResponseDO suspendAssets(Apttus_Config2.CPQStruct.SuspendAssetRequestDO request)
Parameters
Name
Type
Description
request

Apttus_Config2.CPQStruct.SuspendAssetRequestDO

Request object invoked by the method.

Request Data Object - Apttus_Config2.CPQStruct.SuspendAssetRequestDO

Field

Type

Description

Is Required
assetIdsList<Id>List of asset IDs to be suspended. All the asset IDs must be valid and all the assets must be activated.Yes
CartIdIdProduct configuration ID.Yes
CustomDataMap<String, String>Custom field values to be updated. For example, you can pass the reason for suspension as custom data. You can pass more than one custom field. No
NewEndDateDate

Date until which assets must remain suspended. This field is optional in the input. CPQ copies this date to the End Date field in the cart line item.

The end date passed for asset suspension must be less the end date of the asset. If you provide both start date and end date, CPQ considers the end date you provide in this field as the end date for asset suspension. If you do not provide both end date and term, CPQ considers the asset end date as the end date for asset suspension. 

No
NewStartDateDateDate from which assets must be suspended. This field is mandatory in the input.Yes
TermInteger

Term for which assets must be suspended. This field is optional in the input. CPQ copies this date to the Start Date field in the cart line item.

If you do not provide the end date but provide the term, CPQ calculates the end date for asset suspension based on the asset suspension start date and term (according to the selling frequency). If you do not provide both end date and term, CPQ considers the asset end date as the end date for asset suspension. 

No

Response Data Object - Apttus_Config2.CPQStruct.SuspendAssetResponseDO

Field

Type

Description

ErrorsList<String>Contains errors messages if any operations failed.
IsSuccessBooleanIndicates whether the suspend asset operation is successful.
LineItemMapMap<ID,Apttus_Config2__LineItem__c>Indicates the line items to be suspended.


Code Sample

The following code sample helps you suspend assets.

List<Apttus_Config2__AssetLineItem__c> assetLinesToSuspend = [SELECT Id, Apttus_Config2__StartDate__c
															  FROM Apttus_Config2__AssetLineItem__c
															  WHERE Apttus_Config2__AccountId__c = '001630000142XpT'
															  AND Apttus_Config2__ProductId__r.Name = 'AutoABO_ORN_Standalone04'];
 
// asset ids to be suspended
List<Id> assetIds = new List<Id>();
for (Apttus_Config2__AssetLineItem__c assetLineSO : assetLinesToSuspend) 
{
    assetIds.add(assetLineSO.Id);
}

Apttus_Config2.CPQStruct.SuspendAssetRequestDO request = new Apttus_Config2.CPQStruct.SuspendAssetRequestDO();
request.NewStartDate = assetLinesToSuspend[0].Apttus_Config2__StartDate__c.addDays(90);
request.NewEndDate = assetLinesToSuspend[0].Apttus_Config2__StartDate__c.addDays(180);
request.CartId='a5663000002DlFN';
request.assetIds = assetIds;

//input custom field values
Map<String, String> CustomData = new Map<String, String>();
CustomData.put('Apttus_Config2__Comments__c', 'Suspending for 3 months due to late payment');
request.CustomData = CustomData;

Apttus_Config2.CPQStruct.SuspendAssetResponseDO response = Apttus_Config2.AssetService.suspendAssets(request);
system.debug(response.Errors);
system.debug(response.IsSuccess);
CODE