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

Try this

function shouldSend() {
//check if caller is mentioned
if (current.user==current.document.caller_id || current.field_name !='comments'){
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();

Thank you so much sir

If your issue is resolved,please Mark the correct answer and close out this thread.