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
Will DyerWill Dyer 

Trigger apex code on old records

Hi amazing admins,
We have recently fixed some apex code within our system that puts people in regions and areas as instructed to do so via a separate API.
I tried to do a dataloader, uploading the same postal addresses to the contact record, which I thought would trigger the apex code to run on individual records. Will it run if I change one small thing about the address? Or will I have to write some new code?
Many thanks, Will, London - UK
sagar jogisagar jogi
Hello Will,

If your trigger is on before/after update then it will be executed.
The only thing you need to check in your code is that, are you checking field value change using Trigger.old and Trigger.New? If yes and based on that you are executing your logic then your code will not execute
Will DyerWill Dyer
Hi Sagar, 
Thank you for your reply, very helpful. Do you mean the field that I am updating via dataloader or the field that should be populated by the apex code?
sagar jogisagar jogi
No. You just need to update your field using dataloader and it will execute your trigger code
Will DyerWill Dyer
Do I need to change the field in any way? I tried to upload the same data over the weekend and the code did not trigger the apex code.