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
Kevin TullosKevin Tullos 

New Recurring Tasks <> Closed

My org is having an issue with users creating recurring tasks that are complete.  To resolve this now I am changing all the tasks that are closed in the future back to not started.  Since these are recurring tasks, it is a real pain to undo since I have to do it one at a time with the data loader.

If anyone has any ideas on a trigger, would you please post  them so that I can keep this from happening?


Best Answer chosen by Kevin Tullos
Kevin TullosKevin Tullos
I ended up solving this using a trigger and a validation rule...  

The trigger basically populated a few fields that were unaccessable by workflow rule.  Also I performed the update and insert before the save.  see the trigger below.

trigger Populate_Recurrence_ID on Task (before insert, before update) {

    for (Task T :
        t.Recurring_Task_ID__c = t.RecurrenceActivityId;
        t.Recurrence_End_Date__c = t.RecurrenceEndDateOnly;
        t.due_date_trigger__c = t.ActivityDate;

The I created a validation rule that checked to see what the status was, if it was new, and if the due_date_trigger__c field is in future.  With this, I can control when it is on easier since I can turn off a validation rule in production.

Here is the code for the validation rule...

Due_Date_Trigger__c > TODAY() &&
ISPICKVAL (Status, 'Completed')

I hope that this helps someone...