how to trigger notification from Business rules?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2023 07:25 AM
In the Additional Comments Field , whenever @User name is used Email is sent . and those details are stored in the live_notification Table .
so the Business rules should trigger when the live_notificaiton is created for that particular Incident record and the OOB notification should trigger for that particular Caller_id.
and the email sent should be displayed in the activity stream .
Businee rule
table : Live_notification.
when to run after insert and update
(function executeRule(current, previous /*null when async*/) {
var user = new GlideRecord('live_notification');
user.addEncodedQuery('profile' + current.comments.getJournalEntry());
user.addEncodedQuery('document' + current.sys_id);
user.orderByDesc('sys_created_on');
//user.addEncodedQuery('field_name=comments' );
user.query();
gs.log('live= ' + current.comments.getJournalEntry(1));
if(user.next()) {
gs.eventQueue('Activity Stream @Mention Email',current,gs.getUserID(),gs.getUserName());
}
})(current, previous);
Notification is OOB : Activity Stream @Mention Email.
notification is not displaying in the Activity stream.
how tosolve this issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2023 07:45 AM
This is exactly what events are for. You'll notice in your notifications one of the firing conditions is on event.
Here's a couple videos I did to show you how it works.
And if you need to schedule hte event into the future....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2023 05:36 AM
@Uncle Rob the script which i have created is not executing what is wrong in the script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 05:08 AM
I'm not 100% sure but this looks suspect
I think you meant to put an = in there? 'profile='

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2023 11:10 AM
So follow the step by step how to trigger a notification from a business rule:
1. First Step, create a event registry.
On the filter navigator filter by "Events" and select Registry under System Policy > Events >
2. Create a business rule, on my example bellow we are going to trigger every time when category is software and send a e-mail to the current user who created the record or update.
Go to the advance table on the business rule created and add the following script:.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
//trigger the notification example
gs.eventQueue("live.notify",current,current.user.email,"Category Is Software");
//event name // glide record current // email // param3 could be anything
})(current, previous);
3. Create the notification, make sure to select the correct event name created on the previous step
on who will receive:
flag theEvent parm1 contains recipient in order to set the recipient on the business rule
On what will contain select the content of notification, subject, body and etc.. .
on my example im using the param2 to set the data on the notification
Now lets create a incident record, the record was created and the business rule triggered following the conditions insert/update and category = software
And the business rule triggered the event we can see the log on sys_event
And also the outbox notification record was created
Hope that helps, and please let me know if u have any question im glad to help you