back_image
blog-image

SuiteCRM Create a New Scheduled Job by Code

Author Image By Ashish Dwivedi

Last Updated: February 1, 2022

23 minutes

Create a new file at

customExtensionmodulesSchedulersExtScheduledTasks

Let it call “outright_do_repair.php

Content on this file

<?php

array_push($job_strings, ‘outright_do_repair’);

 

Now go to

customExtensionapplicationExtUtils.php

Create a new file , let it call “outright_cron_utils.php”.

Scheduled Job by code

<?php

function outright_do_repair(){

require_once("modules/Administration/QuickRepairAndRebuild.php");

    global $moduleList;

    $repair = new RepairAndClear();

    $repair->repairAndClearAll(array("clearAll"),$moduleList, true,false);

    $exit_on_cleanup = true;

    sugar_cleanup(false);

}

Now go to admin->Scheduler

Then create a new scheduler with created function and set the schedule time.

Stay updated by signing up for our newsletter

Read our full Privacy Policy here.