14

I'm creating a new workflow rule and action (time dependent email alert). The rule is evaluated when the record is "created, and any time it’s edited to subsequently meet criteria." Since it's time dependant workflow rule, you cannot have the rule evaluated when it's "created, and every time it’s edited."

I want it to apply the rule to existing records that meet the condition. How do I do that?

9

nivyaj, I posted an answer to the same (or very similar) question that another admin found helpful: When does the time-based workflow put records in it's queue?

The possible solution is:

  1. Create a checkbox field on your target object called "Retroactively Triggers Workflow?"
  2. Edit your workflow with the time-dependent action to "Evaluate the rule when a record is: created, and any time it’s edited to subsequently meet criteria"
  3. Edit your workflow with the time-dependent action to include an OR condition for "Retroactively Triggers Workflow?" equals True
  4. Do a mass data update as others have suggested to set "Retroactively Triggers Workflow?" to true for the records that need to be retroactively processed

After the workflow actions have fired, you can delete the temporary checkbox field.

2

You'll have to update all of the records that you want to be targeted by the workflow. An easy way would be to use the Data Loader to export the data, make the necessary changes, and then update all of the records. If the records already meet the criteria you may have to update them to not meet the criteria and then update them a second time to meet the criteria again.

  • While this would work, you should be careful about firing any OTHER triggers that rely on the criteria being met. For example, I'm setting up time-dependent tasks that are triggered on a closed-won opp, but if I unclose then reclose the opps to retroactively trigger my workflow, I'll also re-trigger the various email alerts that go out when we close/won an opportunity. – smohyee Nov 11 '13 at 16:54
1

In addition to dataloader, execute anonymous could be used to select and then update the records (even if nothing changes on them). The update will trigger the evaluation of the workflow rules on the records.

List<sObject> objects = [SELECT Id FROM <your object> WHERE <your criteria>];
update objects;

Just be aware of any system behavior which occurs on update of the object whether that be triggers, other workflow rules, etc. and also know that the Last Modified info will reflect this action by you on these records.

  • 2
    This will work only when the workflow rule has the option "Evaluate the rule when a record is created, and any time it’s edited" selected, which is not possible with time-based workflows. The other option, "Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria", will NOT cause the rule to fire if you edit the records without actually changing anything, since that option looks specifically for records which didn't qualify before the edit, and did qualify after. – smohyee Nov 11 '13 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.