1

I would ask if I can disable the Chatter mention in a standard way or I must use a custom solution as a Trigger.

0

3 Answers 3

1

At the moment, Apex Triggers is the only option AFAIK to restrict mention on user/group level.

Suggestion: Use hierarchical custom setting to make the user/profile configurable.

There is [would be] a feature available for groups:

  1. Keep Discussions Focused with Broadcast Groups—Generally Available
  2. Broadcast Groups—Pilot
0

I wrote two triggers, on FeedItem and FeedComment.

FeedItem Trigger:

trigger MentionFeedItem on FeedItem (before insert, before update) {

List<User> listUserPlatform = [SELECT ID, Name FROM User];
List<String> listNameUserPlatform = new List<String>();

for(User u : listaUserPlatform) {
    listNameUserPlatform.add('@'+u.Name);
}

for(FeedItem f : Trigger.new) {
    Boolean nameFinded = false;
    for(Integer i=0; i < listNameUserPlatform.size() && !nameFinded; i++) {
        if( f.Body.contains(listNameUserPlatform.get(i)) ) {
            nameFinded=true;
            f.addError('You can\'t use mention');
        }
    }
}

FeedComment trigger:

trigger MentionFeedComment on FeedComment (before insert, before update) {

List<User> listUserPlatform = [SELECT ID, Name FROM User];
List<String> listNameUserPlatform = new List<String>();

for(User u : listaUserPlatform) {
    listNameUserPlatform.add('@'+u.Name);
}

for(FeedComment f : Trigger.new) {
    Boolean nameFinded = false;
    for(Integer i=0; i < listNameUserPlatform.size() && !nameFinded; i++) {
        if( f.CommentBody .contains(listNameUserPlatform.get(i)) ) {
            nameFinded=true;
            f.addError('You can\'t use mention');
        }
    }
}

}

Thanks :)

0

To basically disable mentions in Salesforce Communities specifically:

1.) In Setup ---> Sharing Settings, Set the Default External Access "Users" to private.

2.) In Setup ---> Sharing Settings, Uncheck both "Portal User Visibility" and "Community User Visibility" checkboxes.

Disable mentions salesforce communities

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .