Loading
The Trailblazer Community is now read-only Read More
Get Started with Communications, Media, and Energy & Utilities (CME)...
AssetFilterInterface

AssetFilterInterface

The AssetFilterInterface provides a way to filter assets. Assets can be filtered based on billing assets, service assets, no contract assets, and more.

You can use the getAssets REST API or the getAssets remote action to retrieve the assets.

Type

Strongly typed

Triggered When

The system triggers AssetFilterInterface when retrieving assets for an account or contract.

Called In

The AssetsListService class calls AssetFilterInterface to retrieve assets.

Signature

Access

Signature

global

String getFilterForAsset(String includesFilter, Id accountId)

Default Implementation

The DefaultAssetFilterImplementationDefaultAssetFilterImplementation is the default implementation for the AssetFilterInterface. It provides four filters for assets.

Other Implementations

None

Input Parameters

getFilterForAsset takes two parameters. The first parameter is the filter string and the second parameter is the account ID associated with the assets.

filterstring

Required

Type: String

The filter to implement:

  • billedAssets retrieves all billing assets

  • serviceAssets retrieves all service assets

  • noContractAssets retrieves all assets that are not linked to any contract

  • allAssets retrieves all assets for the given account. This is the default filter.

accountID

Required

Type: Id

ID of the account associated with the assets

Output Parameters

The output is a filter SOQL string, which can be used as a part of the query to retrieve all assets.

Sample Implementation

global with sharing class DefaultAssetFilterImplementation implements GlobalInterfaces.AssetFilterInterface{
   global String getFilterForAsset(String includesFilter, Id accId) {
      String nsPrefix =  ApplicationUtilities.getNameSpacePrefix();
      String assetQuery = '';
      if(includesFilter == 'billedAssets'){
         assetQuery = 'AND BillingAccountId__c = \'' + accId + '\'';
      }else if(includesFilter == 'noContractAssets'){
         assetQuery = 'AND AccountId = \'' + accId + '\'';
         assetQuery += ' AND ' + nsPrefix+'ContractId__c = null ' ;
      } else if(includesFilter == 'noContractAssets'){
         assetQuery = 'AND AccountId = \'' + accId + '\'';
      } else if (includesFilter == 'serviceAssets'){
         assetQuery = 'AND ServiceAccountId__c = \'' + accId + '\'';
      } else if (includesFilter == 'allAssets'){
         assetQuery = 'AND AccountId = \'' + accId + '\'';
      } else {
         return assetQuery;
      }
      return assetQuery;
   }
}
 
Loading
Salesforce Help | Article