SuiteCRM is a powerful open-source customer relationship management (CRM) system widely used by businesses for managing customer data, sales automation, and marketing activities. One of its key features is the task reminder system, which helps users stay on top of their tasks. In this article, we will demonstrate how to customize SuiteCRM's task reminder feature using PHP to create a more flexible and efficient reminder system.
In SuiteCRM, the task reminder mechanism is primarily powered by scheduled jobs, also known as Cron Jobs. These are automated tasks that run periodically at specified intervals. By customizing the Cron job configuration, developers can define when and how SuiteCRM triggers reminders, such as sending emails or displaying system notifications.
The first step is to create a PHP script that triggers the reminder task. Locate the following file in your SuiteCRM installation directory:
custom/modules/Schedulers/_AddJobsHere.php
Add the following code:
<?php
// Execute the task reminder script
require_once('include/SugarQueue/SugarJobQueue.php');
$job = new SugarJobQueue();
$job->runJob('function::your_custom_function', '', true);
?>Here, your_custom_function is the name of your custom reminder function, which you will define in the next step.
Next, create a PHP file to define the reminder logic. Locate or create the following file:
custom/modules/Schedulers/jobs/SchedulersJob.your_custom_function.php
Add this code:
<?php
class SchedulersJobyour_custom_function extends SchedulersJob
{
public function run($job)
{
$db = DBManagerFactory::getInstance();
// Perform reminder operations such as sending emails or creating notifications
// ...
$job->succeedJob();
}
}
?>Within this function, you can define your own logic — for example, querying tasks due soon and notifying responsible users via email or system alerts.
After defining your function, configure a scheduled task so that SuiteCRM can execute it periodically. Create or edit the following file:
custom/Extension/modules/Schedulers/Ext/ScheduledTasks/your_custom_task.php
Add the following configuration:
<?php
$manifest = array(
'acceptable_sugar_versions' => array(
'regex_matches' => array('5.2.*', '6.*', '7.*', '8.*', '9.*'),
),
'acceptable_sugar_flavors' => array('PRO', 'ENT', 'ULT'),
'name' => 'Your Custom Task',
'description' => 'This is a custom task for your task reminders',
'version' => '1.0.0',
'author' => 'Your Name',
'scheduledefs' => array(
'your_custom_task' => array(
'log_level' => 'debug',
'log_frequency' => 'daily',
'module' => 'Schedulers',
'name' => 'your_custom_task',
'function' => 'your_custom_function',
'allow_multiple' => true,
),
),
);
?>In this file, your_custom_task is the name of the scheduled task, while your_custom_function refers to the function defined earlier.
Once everything is configured, you can manually trigger the reminder script to test if it works correctly. In your SuiteCRM installation directory, execute the following command:
php -f cron.php
If everything is properly configured, SuiteCRM should trigger the reminder at the scheduled intervals.
By following the steps outlined in this article, you can easily customize SuiteCRM’s task reminder system using PHP. With the flexibility of scheduled tasks and custom scripts, developers can create an automated notification process that fits the unique workflow and operational needs of any business.
Official SuiteCRM Documentation: