---
schema_version: "1"
id: d3a858d4fb7d61ff814838b5de1a6d1d41d6de767128b1e0d433f156b4e50894
title: Invoke the Scheduler
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/comms_invoke_the_scheduler.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.comms_invoke_the_scheduler.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: c8a2beabaee67d00b6d2e15534303e920befa5cccdfe1614f02000e52464db00
description: 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.
products:
  - Communications
  - Media
  - Energy and Utilities
release: "264"
---
# Invoke the Scheduler

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](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_scheduler.htm)

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](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-comms_media_energy_managed-264-0-0-production-enus/ff4079f6-a384-475c-b863-578bbbb0ef9b/images/icon_note.png)

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.