1

I have an object class__c. I need to update field boolean field taken as true or false on the basic of order field. Taken__c field is not comming while loading records, Order__C is comming in file.

public void handleBeforeUpdate(Class__c[] newClasses,Map<Id,Class__C> oldMapOfClasses){

    **for(class__c classes:newClasses){
        some things like if(classes.order__c==1){
            classes.taken__c=True;
        }
    }** 

}

What should be best bulkifield approach to it?

  • Are you looking for us to write this for you? What have you tried – EricSSH Apr 11 '16 at 17:10
  • @EricSSH Thanks for quick response.I was just looking if this will bulkified..Like For(class__c classes:newClasses){ if (classes.order__c==1){classes.Taken__C=1;}} – David Mycka Apr 11 '16 at 17:14
  • Bulkification is primarily about executing logic for sets of objects when executing that logic per object would run into the platform's governor limits (such as the number of SOQL queries). Executing simple logic such as your example per object is perfectly normal and does not require any reorganisation for the bulk case. – Keith C Apr 11 '16 at 17:28
2

This can get you started..

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_HelloWorld.htm

Trailhead also has many tutorials

https://developer.salesforce.com/trailhead/en/apex_triggers/apex_triggers_intro

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.