Condition to set in the notification when @user is mentioned in the comments

Thrupthi
Tera Expert

Hi,

We have use "Activity stream @ notification" for emails to be triggered when user is mentioned using @ in the comments, i want to use a condition so that when caller is mentioned using "@" on comments, they should only receive updated notfication, and i don't want them to receive "The user has bee mentioned" notifiaction email.

Can anyone please help me whether we can implement this.

1 ACCEPTED SOLUTION

Try replacing your When to send advanced script with below 

function shouldSend() {
//check if caller is mentioned
if (current.user==current.document.caller_id){
return false;
}

else{
var liveGroupProfileGR = new GlideRecord("live_group_profile");
liveGroupProfileGR.setWorkflow(false);
liveGroupProfileGR.addQuery("document", current.document);
liveGroupProfileGR.addQuery("table", current.table);
liveGroupProfileGR.addQuery("type", "!=", "support");
liveGroupProfileGR.query();

if(liveGroupProfileGR.next()) {
var liveGroupMemberGR = new GlideRecord("live_group_member");
liveGroupMemberGR.setWorkflow(false);
liveGroupMemberGR.addQuery("group", liveGroupProfileGR.getUniqueValue());
liveGroupMemberGR.addQuery("member", current.profile);
liveGroupMemberGR.addQuery("state", "!=", "inactive");
liveGroupMemberGR.query();

if(liveGroupMemberGR.next()) {
return false;
}
}

var SecurityManager = new SNC.LiveFeedSecurityManager();
return SecurityManager.canReadField(current.user, current.table, current.document, current.field_name);
}
}
shouldSend();

Thanks

View solution in original post

7 REPLIES 7

VigneshMC
Mega Sage

Here it is

https://instance_name.service-now.com/nav_to.do?uri=sysevent_email_action.do?sys_id=150055909f021200d5f9b3e2957fcf23%26sysparm_view=advanced

 

Thanks

Hi Vignesh,

 

I have used this earlier and its working fine to trigger notification. But all i want is the below condition to be executed

 

Example:

 

1. Imagine the request was raised by the caller ABC

2. And the fulfiller is XYZ

3. When the fulfiller comments on the ticket by mentioning the caller ABC example @ABC this will be taken care etc....

so in the case like when caller is mentioned on comments using @ABC i want the caller to receive only the notification stating the request has been updated and i dont want the caller to receive "You have been mentioned"

 

So basically i want this @notification to stop trigerring when the caller is mentioned.

 

Can we do this anyhow?

Try replacing your When to send advanced script with below 

function shouldSend() {
//check if caller is mentioned
if (current.user==current.document.caller_id){
return false;
}

else{
var liveGroupProfileGR = new GlideRecord("live_group_profile");
liveGroupProfileGR.setWorkflow(false);
liveGroupProfileGR.addQuery("document", current.document);
liveGroupProfileGR.addQuery("table", current.table);
liveGroupProfileGR.addQuery("type", "!=", "support");
liveGroupProfileGR.query();

if(liveGroupProfileGR.next()) {
var liveGroupMemberGR = new GlideRecord("live_group_member");
liveGroupMemberGR.setWorkflow(false);
liveGroupMemberGR.addQuery("group", liveGroupProfileGR.getUniqueValue());
liveGroupMemberGR.addQuery("member", current.profile);
liveGroupMemberGR.addQuery("state", "!=", "inactive");
liveGroupMemberGR.query();

if(liveGroupMemberGR.next()) {
return false;
}
}

var SecurityManager = new SNC.LiveFeedSecurityManager();
return SecurityManager.canReadField(current.user, current.table, current.document, current.field_name);
}
}
shouldSend();

Thanks

Hi Vignesh,

 

Thanks you so much for your response. It worked absolutely fine..

 

Can i have onemore help from you please...? How do i set the conditions like

1. only when  the Additional comments changes then it should trigger notification.

for the same notificaton table