You are here:
RetireABOAssetImplementation
Change the provisioning status of the existing asset to Retired and creates a new asset with the Active provisioning status.
Interface
ABOAssetInterfaceABOAssetInterface
Sample Code
global with sharing class RetireABOAssetImplementation implements GlobalInterfaces.ABOAssetInterface{
global sObject createAsset(Map<String, Object> input) {
return null;
}
global Map<String, Object> getAssetList(Map<String, Object> input) {
Map<String, Object> outputMap = new Map<String, Object>();
List<Asset> assetList;
List<String> assetRefList = (List<String>)input.get('assetReferenceIdList');
system.debug('assetReferenceIdList is :: '+assetRefList);
if(assetRefList != null && assetRefList.size() > 0){
assetList = [Select Name, ProvisioningStatus__c from Asset where AssetReferenceId__c IN: assetRefList];
system.debug('Asset List is in RETIRE :: '+assetList);
if(assetList != null && assetList.size() > 0)
{
for(Asset a: assetList)
{
if(a.ProvisioningStatus__c == 'Active') //There should be only one asset in the Active Status
a.ProvisioningStatus__c = 'Retired';
}
update assetList;
outputMap.put('assetList', assetList);
}
}
return outputMap;
}
}
Related Implementations
DefaultABOAssetImplementationDefaultABOAssetImplementation

