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
CharuDuttCharuDutt 

if multiple checkbox is checked update picklist field by trigger

i have 4 checkbox field on an object and 1 pickilist field 



1>    if all four checkbox is checked picklist isequal to all active
2>    if any three checkbox is checked picklist isequal to review
3>    if any two checkbox is checked picklist isequal to approved
4>     if one or none checkbox is checked picklist isequal to rejected
Best Answer chosen by CharuDutt
ravi soniravi soni
Hi CharuDutt,
try this following trigger
trigger updateReviwOnOpp on Opportunity (before insert,before update) {
   
    for(Opportunity Opp : trigger.new){
    integer count = 0;
        if(Opp.Field_1__c){
            count++;
        } if(Opp.Field_2__c){
            count++;
        } if(Opp.Field_3__c){
            count++;
        } if( Opp.Field_4__c){
            count++;
        }
        
        if(count==4){
           Opp.review__c = 'all active';
        }
        else if(count == 3){
           Opp.review__c = 'review'; 
        }
        else if(count == 2){
          Opp.review__c = 'approved';   
        }
      else if(count == 1 || count == 0){
        Opp.review__c = 'rejected'; 
     }
        
        
    }
   
}
let me know if it's helps you and mark it as a best so that it helps to others.
Thank you