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
babloo123babloo123 

Trigger Batch

I have a situation where I have writtena code where trigger works if we use trigger.new[0] but I want to standardise for multiple records and to try that I removed trigger.new[0] and made just trigger.new which throws a error can some one guide me how to use trigger.new without error
pconpcon
To handle bulk transactions, you'll want to loop over trigger.new  for example
 
trigger myTrigger on Case (before insert, before update) {
    for (Case c: trigger.new) {
        if (c.myVar__c == 'something') {
            c.myOtherVar__c = 'somethingelse';
        }
    }
}