Set filters to determine the assets that you want to disconnect. The scheduler then filters the assets asynchronously using the Async Engine Framework and disconnects the assets that meet the criteria.
To invoke the cron scheduler, provide these inputs via the constructor:
- inputCustomFilters: A map specifying the filter conditions for the assets. Customers must include asset fields, query operators, and filter values. For example:
// Use below SAMPLE query conditions on Assets to be filtered for disconnection by the Scheduler Map<String, Map<String, Object>> inputCustomFilters = new Map<String, Map<String, Object>> { 'Name' => new Map<String, Object>{ 'operator' => 'LIKE', 'value' => 'ROOT_ASSET%' }, 'vlocity_cmt__InstallDate__c' => new Map<String, Object>{ 'operator' => '>', 'value' => (DateTime.newInstance(2024, 08, 17, 10, 40, 59)).getTime()}, //YYYY,MM,DD,HH,MM,SS 'Status' => new Map<String, Object>{ 'operator' => '=', 'value' => true }, 'SubscriptionStatus__c' => new Map<String, Object>{ 'operator' => 'IN', 'value' => 'Expired,Subpended,Inactive'} }; - maxBatchSizePerJob: An integer from 1 through 200 (values above 200 default to 200). This sets the maximum number of line items that can be processed asynchronously in each run.
- bringAllAssetsToOrder: A boolean. The default value is False. Set to True to move all assets under the account to MACD Order; set to False to move only the assets scheduled for deletion.
- receiversEmailAddress: A string specifying the recipient's email address for notifications. Provide only one email address. If sendEmailNotification is set to False, you can set this field to NULL.
- cron_expression: A string defining the frequency of the cron job. For example, '0 1 00 * * ?' runs the job every day at 12:01 AM. For more details on cron expressions, see Apex Scheduler
This setup offers a flexible and automated solution for managing asset lifecycles, ensuring efficient disconnection of assets based on the specified criteria.
Example code to invoke the scheduler:
Map<String, Map<String, Object>> inputCustomFilters = new Map<String, Map<String, Object>>
{
'Name' => new Map<String, Object>{ 'operator' => 'LIKE', 'value' => 'ROOT_ASSET%' },
'vlocity_cmt__InstallDate__c' => new Map<String, Object>{ 'operator' => '>', 'value' => (DateTime.newInstance(2024, 08, 17, 10, 40, 59)).getTime()}, //YYYY,MM,DD,HH,MM,SS
'Status' => new Map<String, Object>{ 'operator' => '=', 'value' => true },
'SubscriptionStatus__c' => new Map<String, Object>{ 'operator' => 'IN', 'value' => 'Expired,Suspended,Inactive'}
};
Map<String, Object> inputParamMap = new Map<String, Object>();
inputParamMap.put('methodName', 'assetDisconnectScheduler');
inputParamMap.put('inputCustomFilters', inputCustomFilters);
inputParamMap.put('maxBatchSizePerJob', 10);
inputParamMap.put('bringAllAssetsToOrder', false);
inputParamMap.put('sendEmailNotification', true);
inputParamMap.put('receiversEmailAddress', 'your_email_id@xyz.com');
inputParamMap.put('cron_exp', '0 1 00 * * ?');
String inputParamStr = JSON.serialize(inputParamMap);
TelcoAdminConsoleController taccObj = new TelcoAdminConsoleController();
taccObj.setParameters(inputParamStr);
taccObj.invokeMethod();
Note
Set the CPQ setting DeleteAppliedPromo to True if the assets have an applied promotion.
Set the CPQ setting DeletePromoAddedItems to True if the assets were automatically added by a promotion.