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

Checkbox Checked/Un Checked value has to work in trigger

Hi Everyone


i written a trigger to restrict a chatter free user to maka a post,comment,file upload,link upload it is working fine.Now i developed a VF page with some checkboxes like postrestrictions,comment restrivtions,

fileuploadrestrictions etc with an extension controller.
Now my requirement is when a particular check box is checked for example post restrictions is checked then only it has to restrict.
how can i achieve this.
My approach is
VF page:
<apex:page StandardController="FeedItem" Extensions="Utility1">
 <apex:form >
  <apex:pageBlock >
   <apex:inputCheckbox id="Comm" value="{! CommentRestrictions}" label="CommentRestrictions">Comment Restrictions</apex:inputcheckbox> 
<apex:pageblockButtons >
     <apex:commandButton action="{!save}" value="Save"/>
public  class Utility1 {
  public Boolean PostRestrictions=true;
public Boolean Post;
public Apexpages.Standardcontroller cont;
    public Utility1(Apexpages.Standardcontroller controller) {
        System.debug('this is constructor');
    public void setPostRestrictions(Boolean b) {
    this.PostRestrictions = b;         // I THINK DIS SETS THE CHECK BOX CHECKED VALUE
    public Boolean getPostRestrictions() {
     post=this.PostRestrictions;   // i think this will stores the checked value elther true r false
    return this.PostRestrictions;     // IT RETURNS CHECKED VALUE
trigger CFURestrictions on FeedItem (after insert) {
ApexPages.StandardController sc = new ApexPages.standardController(new FeedItem());
    Utility1 u1=new Utility1(sc); // calling controller in trigger
if((exp=true)&& (
fitem.adderror('You do not have permission to share a post.');

can anyone suggest changes  for this my need is also same as this..


Expecting a reply soon