Skip to main content
Hello,

I'm looking for a way to update a checkbox field on the Case (Tax_Task_Completed__c) when a task opened against the case is completed. I've looked to do this declaratively, but I don't believe there's a way to do this... Any ideas on a simple trigger that might do the trick?  
2 answers
  1. Apr 18, 2016, 8:50 PM
    In case, If you had to write a trigger, it would be something like following mockup:

     

    trigger task_After on Task (after insert)

    {

    List<Account> AccountsToUpdate = new List<Account>();

    for (Task t: Trigger.new)

    {

    if (t.Status=='Completed')

    {

    Account a = new Account(Id=t.WhatId);

    a.Account_completion_Status = t.Status;

    AccountsToUpdate.add(a);

    }

    }

    try {

    update AccountsToUpdate;

    } catch (system.Dmlexception e) {

    system.debug (e);

    }

    }

     
Loading
0/9000