Conditions Activity Stream @Mention Email to disable for additional comments

mfhaciahmetoglu
Mega Sage

Hello,

 

At the moment, the trigger (When to send) of the Activity Stream @ Mention Email includes comments also for additional comments. However, this creates confusion as the email script is designed only for work notes. 

 

Is there a way to disable the notification to be generated if the user creates an additional comment?

 

Thanks.

1 ACCEPTED SOLUTION

Janani Swaroopa
Tera Expert

Hi @mfhaciahmetoglu ,

We had the similar requirement to send the notification only when someone is mentioned with @ in the comments and not to send notification when someone is mentioned in the Work notes (Private). We achieved this by modifying the script condition as:

in the notification when to send , Advanced Condition update the code withCondition.JPG :

function shouldSend() {
    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);
}
if(current.field_name != 'work_notes'){
           answer = shouldSend();
}
 
Hope this solution is helpful 🙂

View solution in original post

1 REPLY 1

Janani Swaroopa
Tera Expert

Hi @mfhaciahmetoglu ,

We had the similar requirement to send the notification only when someone is mentioned with @ in the comments and not to send notification when someone is mentioned in the Work notes (Private). We achieved this by modifying the script condition as:

in the notification when to send , Advanced Condition update the code withCondition.JPG :

function shouldSend() {
    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);
}
if(current.field_name != 'work_notes'){
           answer = shouldSend();
}
 
Hope this solution is helpful 🙂