Creating an Alert in SuiteCRM
Alerts in the menu bar are an excellent way of calling user’s attention.
What if you what to create a custom alert through code? It’s easy, here’s how to do it.
With the release of SuiteCRM 7.3 came Alerts. These are displayed
within SuiteCRM as a small badge in the menu bar: |
|
Since these are just stored as beans we can add notifications by simply
creating a new record with the appropriate values and saving it. For
example:
Example
<?php
$alert = BeanFactory::newBean('Alerts');
$alert->name = 'My Alert';
$alert->description = 'This is my alert!';
$alert->url_redirect = 'index.php';
$alert->target_module = 'Account';
$alert->assigned_user_id = '1';
$alert->type = 'info';
$alert->is_read = 0;
$alert->save();
Calling this can be used to create an alert for a specific user like so:
Calling this can be used to create an alert for a specific user like so: |
|
By Jim Mackin | August 25, 2015
|
development