SugarCRM SupportDocumentationSugar DeveloperSugar Developer Guide 8.0ArchitectureJob QueueScheduler JobsCreating Custom Jobs

Creating Custom Jobs


How to create and execute your own custom jobs.

How it Works

As of 6.3.0, custom job functions can be created using the extension framework. The function for the job will be defined in ./custom/Extension/modules/Schedulers/Ext/ScheduledTasks/. Files in this directory are compiled into ./custom/modules/Schedulers/Ext/ScheduledTasks/scheduledtasks.ext.php and then included for use in ./modules/Schedulers/_AddJobsHere.php.

Creating the Job

Use the section below to introduce the technology in relation to the product and describe its benefits.

This first step is to create your jobs custom key. For this example we will be using 'custom_job' as our job key.



//add the job key to the list of job strings
array_push($job_strings, 'custom_job');

function custom_job()
    //custom job code

    //return true for completed
    return true;

Next, we will need to define our jobs label string:



$mod_strings['LBL_CUSTOM_JOB'] = 'Custom Job';

Finally, We will need to navigate to:

Admin / Repair / Quick Repair and Rebuild

Once a Quick Repair and Rebuild has been run, the new job will be available for use when creating new schedulers in:

Admin / Scheduler

Last modified: 2018-04-27 23:34:39