Fetching Asset Line Items
This global method fetches all Asset Line Items for various Accounts.
API |
Signature |
---|---|
getAssetLineItems |
static Apttus_Config2.CPQStruct.QueryAssetsResponseDO getAssetLineItems(Apttus_Config2.CPQStruct.QueryAssetsRequestDO request) |
Parameters |
||
---|---|---|
Name |
Type |
Description |
request | Apttus_Config2.CPQStruct.QueryAssetsRequestDO |
Request object invoked by the method |
Request Data Object - Apttus_Config2.CPQStruct.QueryAssetsRequestDO |
||
---|---|---|
Field |
Type |
Description |
AccountIds | List <Id> |
List of Account Ids |
CustomFilter | String |
SOQL condition expression used as a custom filter. For example, user could request only assets after a given billing end date. This is optional. |
Descending | Boolean |
This indicates whether the assets are sorted in descending order |
FieldNames | List |
This can be used to include fields you have added to the Asset Line Item object. |
Nrecord | Integer |
This can be used to limit the number of records returned |
Offset | Integer |
This can be used to include an offset |
SortFields | List |
This can be used sort the result based on a list of fields. |
Response Data Object - Apttus_Config2.CPQStruct.QueryAssetsResponseDO |
||
---|---|---|
Field |
Type |
Description |
AssetCount | Integer |
The number of assets returned |
AssetLineItems | List |
List of Asset Line Items. |
Code Sample
The code sample below helps you get Asset Line Items for a list of Accounts. Use this global method to fetch all asset line items associated with an account.
// create list of account ids
List<ID> listAccount = new List<ID>();
listAccount.add(accountId);
// create and populate request object
Apttus_Config2.CPQStruct.QueryAssetsRequestDO request = new Apttus_Config2.CPQStruct.QueryAssetsRequestDO();
request.AccountIds = listAccount;
// retrieve all fields in Asset Line Item sObject
request.FieldNames = null;
// sort by billing end date (optinal)
request.SortFields = new List<String>{'Apttus_Config2__BillingEndDate__c'};
request.Descending = false; // sort ascending
request.CustomFilter = 'Apttus_Config2__BillingEndDate__c > 2011-04-30'; // optional
// do not offset and do not limit number of records returned
request.Offset = null;
request.Nrecord = null;
// call getAssetLineItems API
Apttus_Config2.CPQStruct.QueryAssetsResponseDO response = Apttus_Config2.AssetService.getAssetLineItems(request);
List<Apttus_Config2__AssetLineItem__c> listItems = response.AssetLineItems;