SugarCRM SupportProduct GuidesSugar DeveloperSugar Developer Guide 10.3ArchitectureExtensionsScheduledTasks
This release is only available for SugarCloud customers.



The ScheduledTasks extension adds custom functions that can be used by scheduler jobs. For more information about schedulers in Sugar, please refer to the Schedulers documentation.


The following extension properties are available. For more information, please refer to the Extension Property documentation.

Property Value
Extension Scope Module: Schedulers
Sugar Variable $job_strings
Extension Directory ./custom/Extension/modules/Schedulers/Ext/ScheduledTasks/
Compiled Extension File ./custom/Schedulers/Ext/ScheduledTasks/scheduledtasks.ext.php
Manifest Installdef $installdefs['scheduledefs']


The following sections illustrate the various ways to implement a customization to a Sugar instance.

File System

When working directly with the filesystem, you can create a file in ./custom/Extension/modules/Schedulers/Ext/ScheduledTasks/ to add a new Scheduler Task to the system. The following example will create a new Scheduler Task 'example_job':



$job_strings[] = 'exampleJob';

function exampleJob()
    //logic here

    //return true for completed
    return true;

Next, create the Language file for the scheduler so that the job properly displays in Admin > Schedulers:



//Label will be LBL_[upper case function name]
$mod_strings['LBL_EXAMPLEJOB'] = 'Example Job';

Next, navigate to Admin > Repair > Quick Repair and Rebuild. The system will then rebuild the extensions and the customizations will be compiled into ./custom/modules/Schedulers/Ext/ScheduledTasks/scheduledtasks.ext.php

Module Loadable Package

When building a module loadable package, you can use the $installdefs['scheduledefs'] index to install the extension file.

Installdef Properties

Name Type Description
from String The basepath of the file to be installed

The example below demonstrates the proper install definition that should be used in the ./manifest.php file in order to add the custom Scheduler definition file to the system. When using this approach, Sugar will automatically execute Rebuild Extensions to reflect the new Scheduler in the system.



$manifest = array(

$installdefs = array(
    'id' => 'actionView_example',
    'scheduledefs' => array(
            'from' => '<basepath>/Files/custom/Extension/modules/Scheduler/Ext/ScheduledTasks/<file>.php',
    'language' => array(
            'from' =>'<basepath>/Files/custom/Extension/modules/Schedulers/Ext/Language/<file>.php',
            'to_module' => 'Schedulers',
            'language' => 'en_us'

Alternatively, you may use the $installdefs['copy'] index to copy the file. When using this approach, you may need to manually run repair actions such as a Quick Repair and Rebuild. For more information on the $installdefs['copy'] index and module-loadable packages, please refer to the Introduction to the Manifest page.

Last modified: 2021-01-06 23:28:41