SuiteCRM is a powerful open-source customer relationship management (CRM) platform used by businesses of all sizes. Its built-in scheduling module plays a vital role in organizing meetings and managing reminders. However, the default features might not always fulfill complex or specific business requirements. By using PHP, we can enhance the scheduling capabilities and adapt them to real-world needs.
Out of the box, SuiteCRM’s Meetings module allows only basic information input such as the subject, start time, and end time. If your business process requires additional data, such as a location or internal reference code, custom fields can be added easily.
Here’s an example of how to add a custom field in the “Meetings” module:
<?php $dictionary['Meeting']['fields']['custom_field'] = array( 'name' => 'custom_field', 'label' => 'Custom Field', 'vname' => 'LBL_CUSTOM_FIELD', 'type' => 'varchar', 'len' => '255', 'default' => '', 'massupdate' => 0, 'no_default' => false, 'comments' => '', 'help' => '', 'importable' => 'true', 'required' => false, 'reportable' => true, 'audited' => false, 'duplicate_merge' => 'disabled', 'duplicate_merge_dom_value' => '0', 'merge_filter' => 'disabled', 'unified_search' => false, 'calculated' => false, ); $dictionary['Meeting']['fields']['custom_field']['full_text_search'] = array( 'enabled' => true, 'boost' => 0.5, 'searchable' => true, ); $dictionary['Meeting']['fields']['custom_field']['duplicate_merge'] = 'enabled'; $dictionary['Meeting']['fields']['custom_field']['duplicate_merge_dom_value'] = '1'; $dictionary['Meeting']['fields']['custom_field']['calculated'] = false; $dictionary['Meeting']['fields']['custom_field']['required'] = false; $dictionary['Meeting']['fields']['custom_field']['audited'] = false;
After adding the field, run the following command to rebuild the system:
php -f bin/sugarcrm repair
Then, go to the admin panel in SuiteCRM, open the “Layouts” section in the Meetings module, and drag the new custom field into the layout.
To enhance scheduling functionality, a reminder system is essential. SuiteCRM allows us to insert logic through “logic hooks.” Below is a basic implementation using PHP that can be expanded with more advanced notification options such as email or SMS.
First, register the logic hook in the logic_hooks.php file:
<?php $hook_version = 1; $hook_array = array(); $hook_array['before_save'] = array(); $hook_array['before_save'][] = array( 10, 'reminder', 'custom/modules/Meetings/reminder.php', 'reminder', 'beforeSave', );
Then, create the file `reminder.php` in the specified directory and insert this logic:
<?php class reminder { function beforeSave($bean, $event, $arguments) { $before_save_custom_field = $bean->custom_field; // Example use case: log the custom field value file_put_contents('reminder.log', $before_save_custom_field . "\n", FILE_APPEND); } }
This logic will trigger before a meeting is saved, allowing you to integrate a variety of notification methods. The example above logs the custom field value, but it can be modified to send emails, push notifications, or any other form of alert.
By extending SuiteCRM's default functionality through PHP, you can tailor the scheduling module to meet specific business needs. Whether it's adding extra data fields or integrating custom reminders, these enhancements help boost productivity and CRM efficiency. This approach ensures that your SuiteCRM instance evolves alongside your workflow requirements.