Create ae


I made a Schedule job programmaticaly with intention to create alerts from each record of a module (pma_airplane with label “Aeronave”) to a specific user.

I can see it from Scheluder jobs module and can create one that executes each minute (just to test).

The thing is the registry i can see the job is performed but the alerts are not generated

Mi code is:

 * Nombre del método al array $job_strings
 * este es el método que este planificador llamará
$job_strings[] = 'setAlertCritical';

function setAlertCritical(){

  error_log("I'm here", 3,"/var/www/html/suitecrm/suitecrm.log");

    // get the airplanes
    $aiplaneBean = BeanFactory::getBean('Aeronave'); // This is the label of the module, also tried with the name of that module
    $airplaneList = $ $airplaneBean->get_full_list(

    foreach($airplaneList as $airplane){
      // Alert for each airplane
      $alert = BeanFactory:newBean('Alerts');
      $alert->name = "Alert";
      $alert->description = '¡Check this alert!';
      $alert->url_redirect = 'index.php';
      $alert->assigned_user_id = 'id-from-dat4b4se;
      $alert->type = 'info';
      $alert->is_read = 0;

This a SuiteCRM 7.8.2 in spanish CentOS 7

The log with ‘error_log’ is not working either.

So, am i missing something to generate alerts?


Juan, I don’t know the answer to your question, but since you’re obviously doing a lot of development work lately, I would like to ask you if you have XDEBUG set up so you can debug your code?

That is an essential tool for your productivity.

Did you syntax check your code? It looks like you have an extra $ in one of the lines.

php -l

1 Like

First i appreciate so much your help.
I apologize for the bad title with this question.

@mminnie thanks for annotation, i checked and got another sintax issue.

I still don’t get notifications

Even the error_log function doesn’t show nothing


@pgr I’ll take note and begin to use xDebug, i need to think in pro tools for pro work.

I place the script in ‘/modules/Schedulers’ folder.

Is this the right place?


I change the Task of the Schedule job for a URL, but the URL never invokes

Maybe i miss some configuration to this module works?


Basic instructions to create custom Schedulers, from Jim Mackin’s book:

create a file in

Sample content:

 * We add the method name to the $job_strings array.
 * This is the method that jobs for this scheduler will call.
$job_strings[] = 'cleanMeetingsScheduler';

 * Example scheduled job to change any 'Planned' meetings older than a month
 * to 'Not Held'.
 * @return bool
function cleanMeetingsScheduler(){
  //Get the cutoff date for which meetings will be considered
	$cutOff = new DateTime('now - 1 month');
	$cutOff = $cutOff->format('Y-m-d H:i:s');

	//Get an instance of the meetings bean for querying
  //see the Working With Beans chapter.
  $bean = BeanFactory::getBean('Meetings');

  //Get the list of meetings older than the cutoff that are marked as Planned
  $query = "meetings.date_start < '$cutOff' AND meetings.status = 'Planned'";
  $meetings = $bean->get_full_list('',$query);

  foreach($meetings as $meeting){
    //Mark each meeting as Not Held
    $meeting->status = 'Not Held';
    //Save the meeting changes
  //Signify we have successfully ran
  return true;

add a language file in


//We add the mod string for our method here.
 $mod_strings['LBL_CLEANMEETINGSSCHEDULER'] = 'Mark old, planned meetings as Not  Held';

Do a Quick Repair and Rebuild, go to Admin/Schedulers and you should see it there.

Hi pgr.

I cannot see the folder ‘custom/Extension/modules/Schedulers/Ext/ScheduledTasks/’ in my SuiteCRM instance (7.8.2)

I created the file in ‘modules/Schedulers’ and create the language file and had to add the job in the file ‘_AddJobsHere.php’

I made a Quick repair and Rebuild, the new job was added in the list of jobs witouth label just blank.

I add the label in conventional language file and it loads in the list, then i created the job.

The job is listed but is not executed, even try with an URL that never invokes.


Just create any folders that don’t exist yet, so that it goes in the correct location.

Start your job with writiing something in the log, o r creating a file in the filesystem, so you are sure it’s running.

1 Like

Thanks, i created the folders and i tworks