Skip to main content
Hi,

 

I want block posts, comments and Likes in a group whith trigger where group.Name.conatins('inactif')

 

thx
7 respostas
  1. 16 de jul. de 2013, 13:26
    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.');

     

     }

     

       }

     

     }

     

    }
0/9000