You need to sign in to do that
Don't have an account?

question on trigger.New
hi lets say we have trigger that is triggered when object__c is update. then what does for (Object__c c: Trigger.New) mean. Is it a for each loop that goes through every record that has just been updated for the object__c
Hi,
Trigger.New returns the List<Object__c>. If you update a single record then it returns a list of one record for that object.
If you update multiple records at a time, then it will return the list of all records.
Using that
(Object__c c: Trigger.New)
We iterate over the list of Object__c.
All Answers
Hi,
Trigger.New returns the List<Object__c>. If you update a single record then it returns a list of one record for that object.
If you update multiple records at a time, then it will return the list of all records.
Using that
(Object__c c: Trigger.New)
We iterate over the list of Object__c.
To update an existing record, you must use trigger.old
trigger.old gives you list of older version of records.
you can fetch the record, which matches certain criteria and you can update it easily.
Use
(Object__c c : trigger.old)