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
crsofacrsofa 

Update a checkbox based on picklist value

I am trying make a change to the Campaign Members object.  Currently if the Status of Responded is picked from a picklist the responded checkbox automatically is set to checked (true).  I want to write a trigger so that this responded checkbox is set to true when any one of several of the picklist values is chosen.

 

Any ideas would be greatky appreciated!  I'm new to SF admin.....thank!!

Ispita_NavatarIspita_Navatar

You can do this using workflow rules too.

 

Anyways since you wanted help with trigger here's the code snippet:-

 

trigger UpdCampaign on CampaignMember(before insert)
{
  if(Trigger.size == 1)
        {
       
       if(trigger.isInsert)
        {
            if(Trigger.new.picklistvalue__C=='Closed')

               {

               Trigger.new.responded=true;

               }

         }        
}
}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.