• CARLOS ARTURO PINTOR SALOMÓN 3
  • NEWBIE
  • 25 Points
  • Member since 2015
  • Salesforce Consultant
  • Avanxo


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
Trying to build a trigger that will limit posts on a few Chatter Groups.  If anyone posts something that is NOT an announcement in these groups (indicated by 'Announcements' in the Group description), then they should receive an error.

The below code works if there's 1 group, but I need this to work for more than one group.
trigger announcementsOnly on FeedItem (after insert, after update) {

CollaborationGroup group = [SELECT OwnerId, Id FROM CollaborationGroup WHERE Description LIKE '%Announcements%'];
    
 List <FeedItem> fList = new List <FeedItem>();
    
    for(FeedItem items : trigger.new)
        
    {
        
       if(items.ParentId == group.Id && items.Type != 'AdvancedTextPost')

       {
      	 	items.addError('Please post an announcement post, not a text post.);
      	}
    }
    
}
Best answer will be voted on!
 
Ok, our sandbox has just been upgraded to Sumemr16 and we are having issues with our Batch Apex processes.  We current submit a series of batch jobs using "Database.executeBatch" and when the process gets to the 2nd one we get the following error message...
"System.LimitException: Too many async calls created: 2"
I know the limits have been changed to One limit to rule them all, but I thought this was set at 200 not 2.
Anyone else seen this or have any ideas?
thanks
Hi Guys,

Need some help on below dynamic query. I am getting error here somewhere on 'in' operator.
 
list<Call_Memo__share> lstCallMemoShareTemp = Database.query('Select Id from Call_Memo__share'
                                                                     +'where RowCause =: '+Schema.Call_Memo__Share.RowCause.Call_Memo_Sharing_Account_Coverage_Team__c
                                                                     +'And ParentId in'
                                                                     +'(Select Id from Call_Memo__c Where'+ ParentName +' in: '+setParentId+')');

Thanks
 
Trying to build a trigger that will limit posts on a few Chatter Groups.  If anyone posts something that is NOT an announcement in these groups (indicated by 'Announcements' in the Group description), then they should receive an error.

The below code works if there's 1 group, but I need this to work for more than one group.
trigger announcementsOnly on FeedItem (after insert, after update) {

CollaborationGroup group = [SELECT OwnerId, Id FROM CollaborationGroup WHERE Description LIKE '%Announcements%'];
    
 List <FeedItem> fList = new List <FeedItem>();
    
    for(FeedItem items : trigger.new)
        
    {
        
       if(items.ParentId == group.Id && items.Type != 'AdvancedTextPost')

       {
      	 	items.addError('Please post an announcement post, not a text post.);
      	}
    }
    
}
Best answer will be voted on!