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
SFDCCrystalCoSFDCCrystalCo 

Apex Trigger Bulkification

I am trying to get some understanding of when to bulkify code.

My trigger below executes a simple field update when an Account value is changed - no other objects involved here.

I have inserted 600+ Accounts in my Sandbox and subsequently updated these same records with no issues using Data Loader.

That said, do I need to 'bulkify' this code any further?

trigger AccountAllowTransfer on Account (before update) 
{
    for (Account a : Trigger.new) 
    {
        if (a.Producer__c == null)                
        {
            a.Allow_Transfer__c = 'Yes';
        }else{
            a.Allow_Transfer__c = 'No';
        }
    }        
}
Best Answer chosen by SFDCCrystalCo
Amit Chaudhary 8Amit Chaudhary 8
Hi SFDCCrystalCo,

your code is prefect. Nothing you need do for Bulkification. If you want to create Trigger frame work then you can see code in below blog:-
http://amitsalesforce.blogspot.in/2015/06/trigger-best-practices-sample-trigger.html

Please let me know if this will help you.

Thanks
Amit Chaudhary