I want block posts, comments and Likes in a group whith trigger where group.Name.conatins('inactif')
thx
7 respuestas
This should work for comments:
trigger blockComment on FeedComment (before insert){
Map<id,CollaborationGroup> groupMap = new Map<id,CollaborationGroup>([Select Id,Name from CollaborationGroup where Name = 'inactif']);
if(groupMap != null && groupMap.size() > 0){
for(FeedComment fc : trigger.new){
if(fc.ParentId != null && groupMap.containsKey(fc.ParentId)){
fc.addError('This is an inactive group.');
}
}
}
}