I have a
before update trigger on
User object which checks for certain User fields. If that field matches a condition I am supposed to skip the update of that user record, else make some field updates on that record. I achieved this using
newUser.addError('Skipping non-company employees');
When I use data loader to update multiple records, the
before update trigger is executing multiple times. For example, if I have 4 records in my CSV file with one record to be skipped and 3 different email updates to be made on other 3 records, the individuals with the updated email IDs are getting 3 emails each for verifying the email ID change. This means my before update trigger is fired multiple times. When I do not have any records to be skipped with
addError(), this the users get only one verification email, as expected.
This is very strange. I have referred this post, but the explanation given should not make field updates multiple times as per my knowledge.
Any help would be appreciated!