7.9.4
Top right hand side has “Notifications”
I notice this works with Meeting & Call reminders?
Is there anyway to add newly assigned records?
So for example I reassign an account, opportunity or contact etc it appears as a notification on the new assigned user
pgr
5 December 2017 11:37
#2
1 Like
For Desktop Notifications as in those that display directly on your desktop through your web browser
you do something like
Alerts.prototype.show({title: 'test', options: {body: 'lorem ipsum'}})
on the client.
for desktop notifications as in those that display in the top bar of the suitecrm UI you do something like
$alert = BeanFactory::newBean('Alerts');
$alert->name = "Record Assigned";
$alert->description = "{$bean->module_name} assigned to you {$bean->name}";
$alert->assigned_user_id = $bean->assigned_user_id;
$alert->is_read = 0 ;
$alert->type = "info" ;
$alert->target_module = $bean->module_name;
$alert->url_redirect = "index.php?action=ajaxui#ajaxUILoc=";
$alert->url_redirect .= urlencode("index.php?module={$this->record->module_name}&action=DetailView&record={$this->record->id}");
$alert->save();
on the server *
note that this type of notification uses the original module name (if it is targeting a module with an overwritten name) in it’s title. I’ll post an update when I find out how to get around that
2 Likes
To make Alerts show an overwritten module name instead of an original module name, you will need to edit 2 files.
copy
<SUITE_DIR>/modules/Alerts/views/view.default.php
and
<SUITE_DIR>/modules/Alerts/templates/view.default.php
into the custom directory
then make these changes…
in view.default.php add:
$moduleNames = array_intersect(
array_column($this->view_object_map['Results'], 'target_module'),
array_intersect(
$GLOBALS['moduleList'],
array_keys($GLOBALS['beanList'])
)
);
$moduleNames = array_map(function($i) { return translate('LBL_MODULE_NAME', $i); }, $moduleNames);
$this->ss->assign('moduleNames', $moduleNames);
to the display function before the echo
Then in the smarty template add
key=k
in the foreach statement on line 3
and replace
$result->target_module
with
$moduleNames[$k]
in the smarty template on line 12
1 Like
played around with the client side desktop notifications a little more and I’ve come up with a complete example
Alerts.prototype.show({
title: 'TITLE',
options: {
type: 'info',
url_redirect: 'https://url.com',
target_module: 'Call', body: 'lorem ipsum',
icon: 'https://blahblah.jpg'
}
})
so the target_module property is used to get back an icon to use.
The client side script takes in the plural spelling without the s and add’s the s when it is running so modules that use irregular plurals are not compatible with this property.
you can also decide to not use the target_module property and specify the url directly in the icon property.
if you specify both icon will be overridden