RSS
people

SugarCRM custom scheduler job.

Share/Save/Bookmark

Guys, today I am sharing how to create a installation package for custom scheduler job in SugarCRM.

For SugarCRM administrator, the scheduler job functions are always not enough for suit the business logic.
As a administrator, we are always need to create our customize job in order to fulfill the requirement.

In older version of SugarCRM (like 4.x), it required to modified the core file in SugarCRM to just add in a custom scheduler job function. As SugarCRM release version 5.X, it allow administrator add in a job without modifying the core file.

Here is an example on how to create a single scheduler job in SugarCRM 5.X.X.

1. Create a file and name it as “_AddJobsHere.php”

<?php
//SET THE job_string number to 3 digits to prevent crashing with sugarcrm pre-define job id.
$job_strings[102] = 'send_reminder';
 
function send_reminder(){
    //scripts
}
?>

2. Language file for Schedulers module.

<?php
//MAKE SURE THE KEY IS COMBINE OF "LBL_" & SCHEDULER JOB FUNCTION NAME
$mod_strings['LBL_SEND_REMINDER'] = 'Send Reminder';
?>

3. Prepare your package manifest.

<?php
    $manifest = array (
         'acceptable_sugar_versions' =>
          array (
			'5.x.x'
          ),
          'acceptable_sugar_flavors' =>
          array(
            'ENT','PRO'
          ),
          'readme'=>'',
          'key'=>'xxx',
          'author' => 'xxx',
          'description' => 'scheduler job package',
          'icon' => '',
          'is_uninstallable' => true,
          'name' => 'xxx',
          'published_date' => '2010-04-28 11:56:00',
          'type' => 'module',
          'version' => '1.0.0',
          'remove_tables' => 'prompt',
          );
$installdefs = array (
  'id' => 'xxx',
  'beans' =>
  array (
 
  ),
  'layoutdefs' =>
  array (
  ),
  'relationships' =>
  array (
  ),
  'copy' =>
  array (
    array (
      'from' => '<basepath>/SugarModules/custom/modules/Schedulers/_AddJobsHere.php',
      'to' => 'custom/modules/Schedulers/_AddJobsHere.php',
    ),
  ),
  'language' =>
  array (
    array (
      'from' => '<basepath>/SugarModules/language/Schedulers/custom.lang.php',
      'to_module' => 'Schedulers',
      'language' => 'en_us',
    ),
  ),
);

4. zip it and ready to install in your development.

5. Scheduler the job in admin > Scheduler





sample of installation package.

No Responses to “SugarCRM custom scheduler job.”

Leave a Reply