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?
Before going that far, I certain that, You can write a Process Builder on Task to look up its status and create an action to update the related records to selected the account and update it.
Search for the Process Builder in the Setup > Quick Find. Its' a wizard that'll let you pick your Object (Task) and then the corresponding acttions.
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);
Before going that far, I certain that, You can write a Process Builder on Task to look up its status and create an action to update the related records to selected the account and update it.
Search for the Process Builder in the Setup > Quick Find. Its' a wizard that'll let you pick your Object (Task) and then the corresponding acttions.
I believe this should work for you case.
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);