+ Start a Discussion
Roy SinghRoy Singh 

How to update date field on my case record whenever i click on new event and new task by trigger

Hi all,

my problem is i have one last update date field.
i want to update this field on case record whenever i click on new task,log a call and new events on case record and also whnever i change status field and priority field it should be updated.

Thanks
Glyn Anderson 3Glyn Anderson 3
You could write triggers on Case, Task and Event that would update the field on the Case record whenever those changes occur.  You could also do this using Process Builder flows.  The Task and Event trigger logic should execute on "after insert" and test whether the WhatId field looks up to a Case record.  If so, set the Case date field and update the Case record.  The Case trigger logic should execute on "before update" and test whether either Status or Priority fields have changed (by comparing new and old records).  If so, set the Case date field.  No need to update, as you're already in the update trigger.