If you don't want to allow the user to use selected words in the Chatter post, you need to write a trigger on FeedItem
to achieve it.
The sample code is as follows:
trigger FilterOnChatterPost on FeedItem (before insert) { for (FeedItem feeditems: trigger.new) { if (feeditems.Body.containsIgnoreCase('Advertise') || feeditems.Body.containsIgnoreCase('OOO') || feeditems.Body.containsIgnoreCase('Out of Office') || feeditems.Body.containsIgnoreCase('Sex')) { feeditems.addError('Your post contained some word that are not allowd to use'), } } }
By using the containsIgnoreCase
() string class, we simply match each of the feeditem
body that has a specific word. If the specific word is found, then the Your post contained some word that are not allowed to use error is generated.
In the preceding example, the user is getting an error when he is using the words Out of Office in his Chatter post.
3.19.59.0