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
nivyajnivyaj 

how do I fire a trigger on existing data?

Setup:

 

A--< B >-- C . On A there is a RFS on B, and then there is an after update trigger that when run populates fields on B. One of B's Fields are then rolled-up into a field on C.

 

 

Question:

The trigger works, but i need to run it on the existing records in the DB to bring everything up to date. How do I do that? I already tried running a 'force mass recalculation with the RFS on A and C.

sfdcfoxsfdcfox

Just running the Apex Data Loader against all the records would suffice. If you have less than the DML governor limits in record count, you could also try an execute anonymous:

 

update [select id from a__c];

If the results are not what you expect, there may be errors. Check your debug logs from the Execute Anonymous window.

nivyajnivyaj

That's what I was thinking.

 

2 questions:

1. 

This is in  our QA environment. is there a way to do a restore point in case something goes wrong?  Or something that I can do so to we can undo changes?

 

2. This is going to hit a lot of contacts in our contact table. (maybe 3 million contacts or 600k  active contacts?) What do I need to be mindful of in terms of limits? Any potential danger ahead?

JWSJWS

This is a great solution that I've implemented on our org.  Works like a champ.

 

http://cloudyk.com/salesforce/super-easy-apex-batch-to-fire-your-triggers/