You need to sign in to do that
Don't have an account?
Why we should use for loop for trigger? And about the advanced APEX skill.
Thanks to this community provides all the topics and great contributor , especial for Bob, now I write a very good APEX Trigger, and Unit test with 100% Test cover.
But I am still very curious why most people use for loop to initial a trigger.
Such as for(sObject a:tirgger.new)
My trigger only works once update, why we should write it in a for loop?
And I think APEX trigger could do a lot work, I want to move to my next milestone, where I could learn more advanced APEX usage?
Search the method by this guide?
http://www.salesforce.com/us/developer/docs/apexcode/index.htm
This is to ensure the trigger is bulkified - even though you are only expecting it to be called once when the user does something on the UI, it may be that an administrator can hit a number of records in one go, via the import wizard or data loader, which means your trigger would need to process more than one record in a single transaction.
All Answers
This is to ensure the trigger is bulkified - even though you are only expecting it to be called once when the user does something on the UI, it may be that an administrator can hit a number of records in one go, via the import wizard or data loader, which means your trigger would need to process more than one record in a single transaction.
To answer your second question, I would use the Apex Developer's Guide, Developerforce and blogs to gain advanced skills.
Here Trigger.New comes in picture. At the time of bulk load, trigger processes data in chunks of 200 records. These 200 records are stored in Trigger.New list. Now you can loop through this list and do your processing.
thank you so much.