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
SeanCenoSeanCeno 

Uncheck Checkbox In Task Trigger

All,
I have two problems I'm trying to resolve in my trigger. FYI I'm using the design pattern of one trigger per object, so the class holds the code, and then execute the methods in the trigger. 

1.) Method executeLeftMesssage:
Line 42, updates the checkbox to true given the conditions, which is working perfectly. But at the end of this method (Line 74)  I'm trying to update the checkbox to false given Line 71 evaluates to true, but it's not updating the field in the list. What am I missing here?

2.) Method executeContinueProcess:
Line 104, when creating the new opportunity, I'm trying to grab the AccountId, but it keeps returning blank. How can I get this populate in the new opportunity?
 

public class SalesBlitzProcess {
    //Grab List of tasks
    protected final Task[] taskNewList;
    protected final Task[] taskOldList;
    
    public SalesBlitzProcess (Task[] taskOldList, Task[] taskNewList){
        this.taskNewList = taskNewList;
        this.taskOldList = taskOldList;
    }
    
    Set<Id> ContactIds = new Set<Id>();
    List<Contact> taskContacts = [Select Id, AccountId, Account.Name, Nurture_Paused__c FROM Contact Where Id in:ContactIds];
    Map<Id, Contact> cIdMap = new Map<Id, Contact>(taskContacts);
    
    List<Task> taskList = new List<Task>();
    List<Opportunity> oppList = new List<Opportunity>();
    Task t;
    Opportunity o;
    Contact c;
    Account a;
      
     //TODO: Create method to Check and Uncheck Nurture_Paused__c Checkbox within the below methods
    public void executeCheckNP(){
        for(Task t :taskNewList){
            String tId = t.WhoId;
            if(String.valueOf(t.whoId).substring(0,3) == '003'){
                ContactIds.add(t.WhoId);
            }
        }
    }

    
    //Left Message Sales Blitz Process
    private static set<Contact> cSet = new set<Contact>();
     public void executeLeftMessage(){
         if(!RecursiveTriggerHelper.isAlreadyModified()){
             RecursiveTriggerHelper.setAlreadyModified();
             for(Task tsk : taskNewList){
                 if(tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 1' && tsk.Outcome__c == 'Left Message'){
                     //TODO: c.Nurture_Paused__c = True;
                     if(tsk.WhoId != null && String.valueOf(tsk.whoId).substring(0,3) == '003') {
                         c = new Contact(Id = tsk.whoId, Nurture_Paused__c = true);
                         cSet.add(c);
                     }
                     t = new Task();
                     t.OwnerId = tsk.OwnerId;
                     t.WhoId = tsk.WhoId;
                     t.Subject = 'Sales Blitz Call - Day 3';
                     t.Status = 'Not Started';
                     t.ActivityDate = System.Today().addDays(2);
                     taskList.add(t);
                     
                 } else if (tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 3' && tsk.Outcome__c == 'Left Message'){
                     t = new Task();
                     t.OwnerId = tsk.OwnerId;
                     t.WhoId = tsk.WhoId;
                     t.Subject = 'Sales Blitz Call - Day 5';
                     t.Status = 'Not Started';
                     t.ActivityDate = System.Today().addDays(2);
                     taskList.add(t);
                     
                 } else if (tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 5' && tsk.Outcome__c == 'Left Message'){
                     t = new Task();
                     t.OwnerId = tsk.OwnerId;
                     t.WhoId = tsk.WhoId;
                     t.Subject = 'Sales Blitz Call - Day 8';
                     t.Status = 'Not Started';
                     t.ActivityDate = System.Today().addDays(3);
                     taskList.add(t);
                     
                 } else if (tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 8' && tsk.Outcome__c == 'Left Message'){
                     //TODO: c.Nurture_Paused__c = False;
                     if(tsk.WhoId != null && String.valueOf(tsk.whoId).substring(0,3) == '003') {
                         c = new Contact(Id = tsk.whoId, Nurture_Paused__c = false);
                         cSet.add(c);
                     }
                 }
             }
         }
         If(!taskList.isEmpty()){
             insert taskList;
             update new List <Contact>(cSet);
         }
     }
    
    //Create Opportunity if Task has the following outcome
    public void executeContinueProcess(){
        for(Task tsk : taskNewList){
            if(tsk.Status =='Completed' && tsk.Subject == 'Create Opportunity' &&
               (tsk.Outcome__c == 'Set First Advisor Briefing'
                || tsk.Outcome__c == 'Set Qualified Meeting'
                || tsk.Outcome__c == 'Set Existing Producer Meeting'
                || tsk.Outcome__c == 'Set Touch Base Meeting'
                || tsk.Outcome__c == 'Proposal Needed'
                || tsk.Outcome__c == 'Verbal Commitment')){
                    //TODO: c.Nurture_Paused__c = True;
                    if(tsk.WhoId != null && String.valueOf(tsk.whoId).substring(0,3) == '003') {
                        c = new Contact(Id = tsk.whoId, Nurture_Paused__c = true);
                        cSet.add(c);
                    }
                    //TODO Create Opportunity if Task has the following outcome
                    //executeCheckNP();
                    o = new Opportunity();
                    if(tsk.WhoId != null && cIdMap.get(tsk.WhoId) != null){
                        o.AccountId = cIdMap.get(tsk.WhoId).AccountId;
                    }
                    o.Name = 'Temp Opp Name';
                    o.StageName = 'New';
                    o.Opportunity_Potential__c = 0.00;
                    o.CloseDate = Date.today();
                    oppList.add(o);
                }
            //What is the deciding factor for unpausing Nurture here?
            /**if (tsk.WhoId != null && tsk.Status =='Completed' && tsk.Subject == 'Closed Opportunity' && tsk.Outcome__c == 'Closed'){
            //TODO: c.Nurture_Paused__c = False;
            }**/
        }
        If(!oppList.isEmpty()){
            insert oppList;
            update new List <Contact>(cSet);
        }
    }
}



 
trigger SalesBlitzProcess on Task (after insert, after update) {
    Task[] taskOldList = trigger.IsDelete ? null : trigger.old;
    Task[] taskNewList = trigger.IsDelete ? trigger.old : trigger.new;
    new SalesBlitzProcess(trigger.Old, trigger.New).executeLeftMessage();
    new SalesBlitzProcess(trigger.Old, trigger.New).executeContinueProcess();
    //new SalesBlitzProcess(trigger.Old, trigger.New).executeHardNo();
    //new SalesBlitzProcess(trigger.Old, trigger.New).executeNotNow();
}
Best Answer chosen by SeanCeno
SeanCenoSeanCeno
Hey Pankaj,

I believe I have solved my issues. In order to uncheck the checkbox, I had to check If(!cSet.isEmpty()) and then update the List within that clause. As for the recursive trigger, I just had to move my RecursiveTriggerHelper to the actual trigger itself. Very simple mistakes on my part. Thanks again for the help! Here is my final code:
 
public class SalesBlitzProcess {
    //Grab Lst of tasks
    protected final Task[] taskNewList;
    protected final Task[] taskOldList;
    
    public SalesBlitzProcess (Task[] taskOldList, Task[] taskNewList){
        this.taskNewList = taskNewList;
        this.taskOldList = taskOldList;
    }
    
    List<Task> taskList = new List<Task>();
    List<Opportunity> oppList = new List<Opportunity>();
    Task t;
    Opportunity o;
    Contact c;
    Account a;
    
    //Left Message Sales Blitz Process
    List<Contact> cSet = new List<Contact>();
    public void executeLeftMessage(){
        for(Task tsk : taskNewList){
            if(tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 1' && (tsk.Outcome__c == 'Left Message' || tsk.Outcome__c == 'No Answer')){
                //Set c.Nurture_Paused__c = True;
                if(tsk.WhoId != null && String.valueOf(tsk.whoId).substring(0,3) == '003') {
                    c = new Contact(Id = tsk.whoId);
                    c.Nurture_Paused__c = true;
                    cSet.add(c);
                }
                t = new Task();
                t.OwnerId = tsk.OwnerId;
                t.WhoId = tsk.WhoId;
                t.Subject = 'Sales Blitz Call - Day 3';
                t.Status = 'Not Started';
                t.ActivityDate = System.Today().addDays(2);
                taskList.add(t);
                
            } else if (tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 3' && (tsk.Outcome__c == 'Left Message' || tsk.Outcome__c == 'No Answer')){
                t = new Task();
                t.OwnerId = tsk.OwnerId;
                t.WhoId = tsk.WhoId;
                t.Subject = 'Sales Blitz Call - Day 5';
                t.Status = 'Not Started';
                t.ActivityDate = System.Today().addDays(2);
                taskList.add(t);
                
            } else if (tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 5' && (tsk.Outcome__c == 'Left Message' || tsk.Outcome__c == 'No Answer')){
                t = new Task();
                t.OwnerId = tsk.OwnerId;
                t.WhoId = tsk.WhoId;
                t.Subject = 'Sales Blitz Call - Day 8';
                t.Status = 'Not Started';
                t.ActivityDate = System.Today().addDays(3);
                taskList.add(t);
                
            } else if (tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 8' && (tsk.Outcome__c == 'Left Message' || tsk.Outcome__c == 'No Answer')){
                //Set c.Nurture_Paused__c = False;
                if(tsk.WhoId != null && String.valueOf(tsk.whoId).substring(0,3) == '003') {
                    c = new Contact(Id = tsk.whoId);
                    c.Nurture_Paused__c = false;
                    cSet.add(c);
                }
            }
        }
        
        If(!taskList.isEmpty()){
            insert taskList;
        }
        If(!cSet.isEmpty()){
            update new List <Contact>(cSet);
        }
    }
    
    //Create Opportunity if Task has the following outcome
    Set<Id> ContactIds = new Set<Id>();
    public void executeContinueProcess(){
        for(Task tsk : taskNewList){
            if(tsk.Status =='Completed' && tsk.Subject == 'Create Opportunity' &&
               (tsk.Outcome__c == 'Set First Advisor Briefing'
                || tsk.Outcome__c == 'Set Qualified Meeting'
                || tsk.Outcome__c == 'Set Existing Producer Meeting'
                || tsk.Outcome__c == 'Set Touch Base Meeting'
                || tsk.Outcome__c == 'Proposal Needed'
                || tsk.Outcome__c == 'Verbal Commitment')){
                    //Set c.Nurture_Paused__c = True;
                    if(tsk.WhoId != null && String.valueOf(tsk.whoId).substring(0,3) == '003') {
                        c = new Contact(Id = tsk.whoId, Nurture_Paused__c = true);
                        cSet.add(c);
                    }
                    String tId = tsk.WhoId;
                    if(String.ValueOf(tsk.WhoId).substring(0,3) == '003'){
                        ContactIds.add(tsk.WhoId);
                    }
                    
                    List<Contact> taskContacts = [Select Id, AccountId, Account.Name, Nurture_Paused__c FROM Contact Where Id in:ContactIds];
                    Map<Id, Contact> cIdMap = new Map<Id, Contact>(taskContacts);
                    //Create Opportunity if Task has the outcome above
                    o = new Opportunity();
                    system.debug('==========Contact Id ========'+tsk.WhoId);
                    system.debug('==========Contact record ========'+cIdMap.get(tsk.WhoId));
                    system.debug('==========account Id ========'+cIdMap.get(tsk.WhoId).AccountId);
                    if(tsk.WhoId != null && cIdMap.get(tsk.WhoId) != null){
                        o.AccountId = cIdMap.get(tsk.WhoId).AccountId;
                    }
                    o.Name = 'New Sales Blitz Opportunity';
                    o.StageName = 'New';
                    o.Opportunity_Potential__c = 0.00;
                    o.CloseDate = Date.today();
                    oppList.add(o);
                }
            //TODO: What is the deciding factor for unpausing Nurture here?
            if (tsk.Status =='Completed' && tsk.Subject == 'Proposal' && tsk.Outcome__c == 'TBD'){
                if(tsk.WhoId != null && String.valueOf(tsk.whoId).substring(0,3) == '003') {
                    c = new Contact(Id = tsk.whoId);
                    c.Nurture_Paused__c = false;
                    cSet.add(c);
                }
            }
        }
        If(!oppList.isEmpty()){
            insert oppList;
        }
        If(!cSet.isEmpty()){
            update new List <Contact>(cSet);
        }
    }
}

trigger SalesBlitzProcess on Task (after insert, after update) {
    if(!RecursiveTriggerHelper.isAlreadyModified()){
        RecursiveTriggerHelper.setAlreadyModified();{
            Task[] taskOldList = trigger.IsDelete ? null : trigger.old;
            Task[] taskNewList = trigger.IsDelete ? trigger.old : trigger.new;
            new SalesBlitzProcess(trigger.Old, trigger.New).executeLeftMessage();
            new SalesBlitzProcess(trigger.Old, trigger.New).executeContinueProcess();
            //new SalesBlitzProcess(trigger.Old, trigger.New).executeHardNo();
            //new SalesBlitzProcess(trigger.Old, trigger.New).executeNotNow();
        }
    }
}

RecursiveTriggerHelper Class:
public class RecursiveTriggerHelper {
    private static boolean alreadyModified = false;
    
    // get the state
    public static boolean isAlreadyModified(){
        return alreadyModified;
    }
    
    //set this to true to keep track of and avoid recursive updates. Generally set
    //after first time through the trigger.
    
    public static void setAlreadyModified(){
        alreadyModified = true;
    }
}





 

All Answers

Pankaj_GanwaniPankaj_Ganwani
Hi Sean,

Just use List<Contact> instead of using set<Contact>. I have just modified your method a little bit. Please check if this works for you:
//Left Message Sales Blitz Process
    List<Contact> cSet = new List<Contact>();
     public void executeLeftMessage(){
         if(!RecursiveTriggerHelper.isAlreadyModified()){
             RecursiveTriggerHelper.setAlreadyModified();
             for(Task tsk : taskNewList){
                 if(tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 1' && tsk.Outcome__c == 'Left Message'){
                     //TODO: c.Nurture_Paused__c = True;
                     if(tsk.WhoId != null && String.valueOf(tsk.whoId).substring(0,3) == '003') {
                         c = new Contact(Id = tsk.whoId);
                         c.Nurture_Paused__c = true;
                         cSet.add(c);
                     }
                     t = new Task();
                     t.OwnerId = tsk.OwnerId;
                     t.WhoId = tsk.WhoId;
                     t.Subject = 'Sales Blitz Call - Day 3';
                     t.Status = 'Not Started';
                     t.ActivityDate = System.Today().addDays(2);
                     taskList.add(t);
                     
                 } else if (tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 3' && tsk.Outcome__c == 'Left Message'){
                     t = new Task();
                     t.OwnerId = tsk.OwnerId;
                     t.WhoId = tsk.WhoId;
                     t.Subject = 'Sales Blitz Call - Day 5';
                     t.Status = 'Not Started';
                     t.ActivityDate = System.Today().addDays(2);
                     taskList.add(t);
                     
                 } else if (tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 5' && tsk.Outcome__c == 'Left Message'){
                     t = new Task();
                     t.OwnerId = tsk.OwnerId;
                     t.WhoId = tsk.WhoId;
                     t.Subject = 'Sales Blitz Call - Day 8';
                     t.Status = 'Not Started';
                     t.ActivityDate = System.Today().addDays(3);
                     taskList.add(t);
                     
                 } else if (tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 8' && tsk.Outcome__c == 'Left Message'){
                     //TODO: c.Nurture_Paused__c = False;
                     if(tsk.WhoId != null && String.valueOf(tsk.whoId).substring(0,3) == '003') {
                         c = new Contact(Id = tsk.whoId);
                         c.Nurture_Paused__c = false;
                         cSet.add(c);
                     }
                 }
             }
         }
         If(!taskList.isEmpty()){
             insert taskList;
             update new List <Contact>(cSet);
         }
     }


Just put the debug statements at line no 105 in executeContinueProcess() and check whether you are getting AccountId field value or not?
 
SeanCenoSeanCeno
Hey Pankaj,

It seems that the check box still does not uncheck given the conditions. Also, when creating the Opportunity, the debug statement is returning that AccountId as null.

 
Pankaj_GanwaniPankaj_Ganwani
Hi Sean,

There is no other way to find the exact caluse of the issue except debugging. Just put below mentioned debug statements at line no 105 and see what comes:

system.debug('==========Contact Id ========'+tsk.WhoId);
system.debug('==========Contact record ========'+cIdMap.get(tsk.WhoId));
system.debug('==========account Id ========'+cIdMap.get(tsk.WhoId).AccountId);
 
SeanCenoSeanCeno
Hey Pankaj,

Yeah,
system.debug('==========account Id ========'+cIdMap.get(tsk.WhoId).AccountId);
is giving me a null pointer exception.

Does this mean my cIdMap isn't being populated?
SeanCenoSeanCeno
Hey Pankaj,

So it turns out my map was not populating. I ended up moving the List and Map inside my executeContinueProcess method, and now it populates the AccountId in the newly created Opportunity. Unfortunately, I am getting a recursive trigger fire. If I add in my RecursiveTriggerHelper to block it, the Opportunity is then not created at all. Can you see what I'm missing? And also, I can't seem to fix the uncheck of the checkbox.

Here is my current code:
 
public class SalesBlitzProcess {
    //Grab Lst of tasks
    protected final Task[] taskNewList;
    protected final Task[] taskOldList;
    
    public SalesBlitzProcess (Task[] taskOldList, Task[] taskNewList){
        this.taskNewList = taskNewList;
        this.taskOldList = taskOldList;
    }
    
    List<Task> taskList = new List<Task>();
    List<Opportunity> oppList = new List<Opportunity>();
    Task t;
    Opportunity o;
    Contact c;
    Account a;
    
    //Left Message Sales Blitz Process
    List<Contact> cSet = new List<Contact>();
    public void executeLeftMessage(){
        if(!RecursiveTriggerHelper.isAlreadyModified()){
            RecursiveTriggerHelper.setAlreadyModified();
            for(Task tsk : taskNewList){
                if(tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 1' && (tsk.Outcome__c == 'Left Message' || tsk.Outcome__c == 'No Answer')){
                    //Set c.Nurture_Paused__c = True;
                    if(tsk.WhoId != null && String.valueOf(tsk.whoId).substring(0,3) == '003') {
                        c = new Contact(Id = tsk.whoId);
                        c.Nurture_Paused__c = true;
                        cSet.add(c);
                    }
                    t = new Task();
                    t.OwnerId = tsk.OwnerId;
                    t.WhoId = tsk.WhoId;
                    t.Subject = 'Sales Blitz Call - Day 3';
                    t.Status = 'Not Started';
                    t.ActivityDate = System.Today().addDays(2);
                    taskList.add(t);
                    
                } else if (tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 3' && (tsk.Outcome__c == 'Left Message' || tsk.Outcome__c == 'No Answer')){
                    t = new Task();
                    t.OwnerId = tsk.OwnerId;
                    t.WhoId = tsk.WhoId;
                    t.Subject = 'Sales Blitz Call - Day 5';
                    t.Status = 'Not Started';
                    t.ActivityDate = System.Today().addDays(2);
                    taskList.add(t);
                    
                } else if (tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 5' && (tsk.Outcome__c == 'Left Message' || tsk.Outcome__c == 'No Answer')){
                    t = new Task();
                    t.OwnerId = tsk.OwnerId;
                    t.WhoId = tsk.WhoId;
                    t.Subject = 'Sales Blitz Call - Day 8';
                    t.Status = 'Not Started';
                    t.ActivityDate = System.Today().addDays(3);
                    taskList.add(t);
                    
                } else if (tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 8' && (tsk.Outcome__c == 'Left Message' || tsk.Outcome__c == 'No Answer')){
                    //TODO: c.Nurture_Paused__c = False;
                    if(tsk.WhoId != null && String.valueOf(tsk.whoId).substring(0,3) == '003') {
                        c = new Contact(Id = tsk.whoId);
                        c.Nurture_Paused__c = false;
                        cSet.add(c);
                    }
                }
            }
        }
        If(!taskList.isEmpty()){
            insert taskList;
            update new List <Contact>(cSet);
        }
    }

    //Create Opportunity if Task has the following outcome
    Set<Id> ContactIds = new Set<Id>();
    public void executeContinueProcess(){
        //if(!RecursiveTriggerHelper.isAlreadyModified()){
            //RecursiveTriggerHelper.setAlreadyModified();
            for(Task tsk : taskNewList){
                if(tsk.Status =='Completed' && tsk.Subject == 'Create Opportunity' &&
                   (tsk.Outcome__c == 'Set First Advisor Briefing'
                    || tsk.Outcome__c == 'Set Qualified Meeting'
                    || tsk.Outcome__c == 'Set Existing Producer Meeting'
                    || tsk.Outcome__c == 'Set Touch Base Meeting'
                    || tsk.Outcome__c == 'Proposal Needed'
                    || tsk.Outcome__c == 'Verbal Commitment')){
                        //Set c.Nurture_Paused__c = True;
                        if(tsk.WhoId != null && String.valueOf(tsk.whoId).substring(0,3) == '003') {
                            c = new Contact(Id = tsk.whoId, Nurture_Paused__c = true);
                            cSet.add(c);
                        }
                        String tId = tsk.WhoId;
                        if(String.ValueOf(tsk.WhoId).substring(0,3) == '003'){
                            ContactIds.add(tsk.WhoId);
                        }
                        
                        List<Contact> taskContacts = [Select Id, AccountId, Account.Name, Nurture_Paused__c FROM Contact Where Id in:ContactIds];
                        Map<Id, Contact> cIdMap = new Map<Id, Contact>(taskContacts);
                        //TODO Create Opportunity if Task has the outcome above
                        o = new Opportunity();
                        system.debug('==========Contact Id ========'+tsk.WhoId);
                        system.debug('==========Contact record ========'+cIdMap.get(tsk.WhoId));
                        system.debug('==========account Id ========'+cIdMap.get(tsk.WhoId).AccountId);
                        if(tsk.WhoId != null && cIdMap.get(tsk.WhoId) != null){
                            o.AccountId = cIdMap.get(tsk.WhoId).AccountId;
                        }
                        o.Name = 'New Sales Blitz Opportunity';
                        o.StageName = 'New';
                        o.Opportunity_Potential__c = 0.00;
                        o.CloseDate = Date.today();
                        oppList.add(o);
                    }
                /**TODO: What is the deciding factor for unpausing Nurture here?
                if (tsk.WhoId != null && tsk.Status =='Completed' && tsk.Subject == 'Closed Opportunity' && tsk.Outcome__c == 'Closed'){
                 TODO: c.Nurture_Paused__c = False;
                }**/
            //}//
        }
        If(!oppList.isEmpty()){
            system.debug('The value is:' + oppList);
            insert oppList;
            update new List <Contact>(cSet);
        }
    }
}

trigger SalesBlitzProcess on Task (after insert, after update) {
    Task[] taskOldList = trigger.IsDelete ? null : trigger.old;
    Task[] taskNewList = trigger.IsDelete ? trigger.old : trigger.new;
    new SalesBlitzProcess(trigger.Old, trigger.New).executeLeftMessage();
    new SalesBlitzProcess(trigger.Old, trigger.New).executeContinueProcess();
}

 
SeanCenoSeanCeno
Hey Pankaj,

I believe I have solved my issues. In order to uncheck the checkbox, I had to check If(!cSet.isEmpty()) and then update the List within that clause. As for the recursive trigger, I just had to move my RecursiveTriggerHelper to the actual trigger itself. Very simple mistakes on my part. Thanks again for the help! Here is my final code:
 
public class SalesBlitzProcess {
    //Grab Lst of tasks
    protected final Task[] taskNewList;
    protected final Task[] taskOldList;
    
    public SalesBlitzProcess (Task[] taskOldList, Task[] taskNewList){
        this.taskNewList = taskNewList;
        this.taskOldList = taskOldList;
    }
    
    List<Task> taskList = new List<Task>();
    List<Opportunity> oppList = new List<Opportunity>();
    Task t;
    Opportunity o;
    Contact c;
    Account a;
    
    //Left Message Sales Blitz Process
    List<Contact> cSet = new List<Contact>();
    public void executeLeftMessage(){
        for(Task tsk : taskNewList){
            if(tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 1' && (tsk.Outcome__c == 'Left Message' || tsk.Outcome__c == 'No Answer')){
                //Set c.Nurture_Paused__c = True;
                if(tsk.WhoId != null && String.valueOf(tsk.whoId).substring(0,3) == '003') {
                    c = new Contact(Id = tsk.whoId);
                    c.Nurture_Paused__c = true;
                    cSet.add(c);
                }
                t = new Task();
                t.OwnerId = tsk.OwnerId;
                t.WhoId = tsk.WhoId;
                t.Subject = 'Sales Blitz Call - Day 3';
                t.Status = 'Not Started';
                t.ActivityDate = System.Today().addDays(2);
                taskList.add(t);
                
            } else if (tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 3' && (tsk.Outcome__c == 'Left Message' || tsk.Outcome__c == 'No Answer')){
                t = new Task();
                t.OwnerId = tsk.OwnerId;
                t.WhoId = tsk.WhoId;
                t.Subject = 'Sales Blitz Call - Day 5';
                t.Status = 'Not Started';
                t.ActivityDate = System.Today().addDays(2);
                taskList.add(t);
                
            } else if (tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 5' && (tsk.Outcome__c == 'Left Message' || tsk.Outcome__c == 'No Answer')){
                t = new Task();
                t.OwnerId = tsk.OwnerId;
                t.WhoId = tsk.WhoId;
                t.Subject = 'Sales Blitz Call - Day 8';
                t.Status = 'Not Started';
                t.ActivityDate = System.Today().addDays(3);
                taskList.add(t);
                
            } else if (tsk.Status =='Completed' && tsk.Subject == 'Sales Blitz Call - Day 8' && (tsk.Outcome__c == 'Left Message' || tsk.Outcome__c == 'No Answer')){
                //Set c.Nurture_Paused__c = False;
                if(tsk.WhoId != null && String.valueOf(tsk.whoId).substring(0,3) == '003') {
                    c = new Contact(Id = tsk.whoId);
                    c.Nurture_Paused__c = false;
                    cSet.add(c);
                }
            }
        }
        
        If(!taskList.isEmpty()){
            insert taskList;
        }
        If(!cSet.isEmpty()){
            update new List <Contact>(cSet);
        }
    }
    
    //Create Opportunity if Task has the following outcome
    Set<Id> ContactIds = new Set<Id>();
    public void executeContinueProcess(){
        for(Task tsk : taskNewList){
            if(tsk.Status =='Completed' && tsk.Subject == 'Create Opportunity' &&
               (tsk.Outcome__c == 'Set First Advisor Briefing'
                || tsk.Outcome__c == 'Set Qualified Meeting'
                || tsk.Outcome__c == 'Set Existing Producer Meeting'
                || tsk.Outcome__c == 'Set Touch Base Meeting'
                || tsk.Outcome__c == 'Proposal Needed'
                || tsk.Outcome__c == 'Verbal Commitment')){
                    //Set c.Nurture_Paused__c = True;
                    if(tsk.WhoId != null && String.valueOf(tsk.whoId).substring(0,3) == '003') {
                        c = new Contact(Id = tsk.whoId, Nurture_Paused__c = true);
                        cSet.add(c);
                    }
                    String tId = tsk.WhoId;
                    if(String.ValueOf(tsk.WhoId).substring(0,3) == '003'){
                        ContactIds.add(tsk.WhoId);
                    }
                    
                    List<Contact> taskContacts = [Select Id, AccountId, Account.Name, Nurture_Paused__c FROM Contact Where Id in:ContactIds];
                    Map<Id, Contact> cIdMap = new Map<Id, Contact>(taskContacts);
                    //Create Opportunity if Task has the outcome above
                    o = new Opportunity();
                    system.debug('==========Contact Id ========'+tsk.WhoId);
                    system.debug('==========Contact record ========'+cIdMap.get(tsk.WhoId));
                    system.debug('==========account Id ========'+cIdMap.get(tsk.WhoId).AccountId);
                    if(tsk.WhoId != null && cIdMap.get(tsk.WhoId) != null){
                        o.AccountId = cIdMap.get(tsk.WhoId).AccountId;
                    }
                    o.Name = 'New Sales Blitz Opportunity';
                    o.StageName = 'New';
                    o.Opportunity_Potential__c = 0.00;
                    o.CloseDate = Date.today();
                    oppList.add(o);
                }
            //TODO: What is the deciding factor for unpausing Nurture here?
            if (tsk.Status =='Completed' && tsk.Subject == 'Proposal' && tsk.Outcome__c == 'TBD'){
                if(tsk.WhoId != null && String.valueOf(tsk.whoId).substring(0,3) == '003') {
                    c = new Contact(Id = tsk.whoId);
                    c.Nurture_Paused__c = false;
                    cSet.add(c);
                }
            }
        }
        If(!oppList.isEmpty()){
            insert oppList;
        }
        If(!cSet.isEmpty()){
            update new List <Contact>(cSet);
        }
    }
}

trigger SalesBlitzProcess on Task (after insert, after update) {
    if(!RecursiveTriggerHelper.isAlreadyModified()){
        RecursiveTriggerHelper.setAlreadyModified();{
            Task[] taskOldList = trigger.IsDelete ? null : trigger.old;
            Task[] taskNewList = trigger.IsDelete ? trigger.old : trigger.new;
            new SalesBlitzProcess(trigger.Old, trigger.New).executeLeftMessage();
            new SalesBlitzProcess(trigger.Old, trigger.New).executeContinueProcess();
            //new SalesBlitzProcess(trigger.Old, trigger.New).executeHardNo();
            //new SalesBlitzProcess(trigger.Old, trigger.New).executeNotNow();
        }
    }
}

RecursiveTriggerHelper Class:
public class RecursiveTriggerHelper {
    private static boolean alreadyModified = false;
    
    // get the state
    public static boolean isAlreadyModified(){
        return alreadyModified;
    }
    
    //set this to true to keep track of and avoid recursive updates. Generally set
    //after first time through the trigger.
    
    public static void setAlreadyModified(){
        alreadyModified = true;
    }
}





 
This was selected as the best answer