Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

how to trigger notification from Business rules?

instance
Tera Contributor

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?

6 REPLIES 6

@raphaelcrv  In return the Body of the Email and the Recepients should be captured in the activity in incident record how to do that?

The e-mail will be on the activity when the e-mail status is changed to sent, if you are using a lower enviroment like staging or dev, go to the outbox find the e-mail record created and change the status to sent and take a look on the activity 


Let me know if worked 

If my response was helpful and/or provided a solution, please consider marking it as such. Thank you!