How to create a Custom Scheduler in SugarCRM

SugarCRM comes with its pre-defined Schedulers which you can set from Admin->Schedulers.Schedulers comes into place when you want to perform a recurring job .It is just as Linux Crontab.

crm-scheduler
CRM Scheduler

To create a custom scheduler you can use the Ext framework of Sugarcrm.

STEP 1 : Create a file MyJob.php in custom/Extension/modules/Schedulers/Ext/ScheduledTasks/ with the following code therein

<?php
$job_strings[] = 'MyJob';
 function MyJob(){
 //this is where you put the custom code
 }

STEP 2 : The next step is to create a language file for our custom scheduler.Create en_us.MyJob.php in custom/Extension/modules/Schedulers/Ext/Language/ with the following code

<?php
$mod_strings['LBL_MYJOB'] = 'My Custom Job';

STEP 3 : Do a Quick Repair and Rebuild . Your custom scheduler will now be available in the Scheduler dropdown list.After which you can set its execution interval.

NEVER DO THIS

Creating custom Scheduler via _AddJobsHere.php is not recommended.Its a shared file and any other customizations can simply override your scheduler.The safest way is to use the Ext framework discussed above.However you will have to use _AddJobsHere file for Sugar Version less than 6.4.

 

Advertisements

One thought on “How to create a Custom Scheduler in SugarCRM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s