function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sai Ram ASai Ram A 

How to restrict the User to write into publicGroup only through UI

Hi All

   

- The ACB Public chatter group how can we disable the capability for a user to Post new feed.

- Post feed are only created though the workflow. How can we handle this

 

the below code doesnot allows user to write post in public group

 

trigger RestrictChatterPost on FeedItem (Before Insert) 
{  
   CollaborationGroup  lstgroup = [SELECT id, name FROM CollaborationGroup WHERE CollaborationGroup.Name = 'xyz' LIMIT 1];
 
    for(FeedItem a : Trigger.New)
    {
        
            if(a.parentid == 'Sfd00000000Ceh3')
            
            a.addError('You are NOT allowed to post in this chatter Group!');
        
    }
}

 

This code is also restricting to post after the approval process(back end)..

my requirement: I just want to restrict user to write from UI. 

 

Please Suggest me. Thank you

 

Jia HuJia Hu
Feed type of approval process is ApprovalPost, you can add the filter selection for the Type and let the ApprovalPost be posted.

Not sure how you post through Workflow,...