I installed a new version of suitecrm 7.3.2max. and also 7.6.4 but in both the versions, Alerts are not workingā¦
I tried enabling desktop notifications from admin but it didnāt workā¦
Tried a few changes in the code as wellā¦ But no luckā¦
I am sending the code which I saved in the (instancename)/custom/modules/accounts/accounts.php
Code:
Creating a Logic Hook using the Extension Framework
./custom/Extension/modules//Ext/LogicHooks/.php
<?php
$hook_array['after_save'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'after_save example',
//The PHP file where your class is located.
'custom/modules//after_save_class.php',
//The class the method is in.
'after_save_class',
//The method to call.
'after_save_method'
);
?>
./custom/modules//after_save_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class after_save_class
{
function after_save_method($bean, $event, $arguments)
{
$alert = BeanFactory::newBean('Alerts');
$alert->name = 'My Alert';
$alert->description = 'This is my alert!';
$alert->url_redirect = 'index.php';
$alert->target_module = 'Accounts';
$alert->assigned_user_id = '1';
$alert->type = 'info';
$alert->is_read = 0;
$alert->save();
}
}
?>
We created for accounts moduleā¦ similarly we can create for all modulesā¦
Only one thing that we are stuck isā¦ in the above code ā¦
$alert->assigned_user_id = ā1ā;
by the above line of code, this alert can be created only for one user at a time whose ID we put in the assigned user placeā¦
So can anyone suggest how can we create it for all users irrespective of the users ā¦
06/06/16 11:25:41 [5484][1][FATAL] Error running count query for User List: Query Failed: SELECT count(*) c FROM users LEFT JOIN users jt2 ON users.reports_to_id=jt2.id AND jt2.deleted=0
AND jt2.deleted=0 where (users->status=āactiveā) AND users.deleted=0: MySQL error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ā>status=āactiveā) AND users.deleted=0ā at line 3
06/06/16 11:34:57 [5484][1][FATAL] Error running count query for User List: Query Failed: SELECT count(*) c FROM users LEFT JOIN users jt2 ON users.reports_to_id=jt2.id AND jt2.deleted=0
AND jt2.deleted=0 where (users->status=āactiveā) AND users.deleted=0: MySQL error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ā>status=āactiveā) AND users.deleted=0ā at line 3
Look here http://alanstorm.com/sugarcrm_model_bean
You have the respond ā¦ read this page and find the error. This is a lessons for learn.
After come back and give the solution.