Wants to run a rule 6 times in day

Another option would be to use a Custom object as a persistent data store.

  1. Load the custom object, and then load the list of Failed Tasks from the Custom Object
  2. Run your rule logic and build a List of all failed tasks
  3. Compare the list of failed tasks you loaded from the Custom object in #1 to the List of failed tasks you calculated in #2 - this will tell you what new task failures occurred since the last run
  4. Update the Custom object with the updated list of failed tasks you calculated and built in #2, and save the updated Custom object

Now you can run that rule as often/infrequently as you like, since the rule’s data analysis should be self-sustaining.

Note: I used a List for the failed tasks, but you could also build it to use a Map instead (entry key being the task name and value being the last launched time for example) and base your comparison using the Map containsKey(Object o) method, and double-checking/confirming if it’s a new failure or not by checking the last launch timestamp of the “discovered failed task” from #2 to the value element of the saved failure of a previous run that you loaded into your custom object.

1 Like