I built a trigger on Object 1 which has a field, field1 which when updated will calculate another field, field2 in same object (had to use trigger for it's complexity).

Now my question is that field1 is already available in the object, for which I have to perform update in order to fill up field2 field. So how do I prepare the csv file for the dummy update?

Is my following way the right?

  1. First download csv containing the record ids and with field1.
  2. Update with same file with data loader.

Thanks in advance.

  • Are you doing this for the single reason of getting field2 to populate?
    – BarCotter
    Feb 16, 2015 at 10:11
  • yes, is this not the corret way?
    – MnZ
    Feb 16, 2015 at 10:24
  • It's one way to do it. You could also run some anonymous apex or use the batch API to do it. How many records to you need to set the field on?
    – BarCotter
    Feb 16, 2015 at 10:25
  • ok! 36k. Anonymous apex is the easiest way! But then I think governor limits will come into picture
    – MnZ
    Feb 16, 2015 at 10:28
  • What does your trigger logic look like? Does it check to see if field1 has changed? or does it fire when field1 is set and field2 is null?
    – BarCotter
    Feb 16, 2015 at 10:31

1 Answer 1


It looks like your trigger doesn't check to see if field1 has changed, only that it is set. This means that all you need to do is run some anonymous apex to get the trigger to fire. You don't even need to change any fields on the records. If you execute the code below it will cause your trigger to fire:

update [select id from Object1 where field1 != null and field2 = null];

If your trigger is not bulkified then you may hit some limits. If you do you can fire the trigger on less records in a single transaction until you get them all updated. See the code below which will only update 1000 records.

update [select id from Object1 where field1 != null and field2 = null limit:1000];
  • Is there any reason you are specifying limit as 1000?
    – Krishna
    Apr 24, 2017 at 20:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .