You need to sign in to do that
Don't have an account?
Edward East
Update Task Status when Lead Status Changes
I am trying to write a trigger that will automatically mark a task called 'Lead - Intro' as complete when the Lead Status changes from Open to Contacted. I tried cobbling it together from various similiar things I've found on the forum, but there are big chunks missing and I've sort of hit a brick wall. This is how far I've come so far:
trigger updateTaskStatus on Lead (after update) {
try{
for(Lead myLead: Trigger.new){
if((myLead.isconverted==false) && (myLead.Status == 'Contacted')) {
List<Task> taskstatus = new List<Task>();
for (Task t: taskstatus){
if (t.Subject == 'Lead - Intro') && (t.Status == 'Open') {
t.Status = 'Completed';
}
Update taskstatus;
}
trigger updateTaskStatus on Lead (after update) {
try{
for(Lead myLead: Trigger.new){
if((myLead.isconverted==false) && (myLead.Status == 'Contacted')) {
List<Task> taskstatus = new List<Task>();
for (Task t: taskstatus){
if (t.Subject == 'Lead - Intro') && (t.Status == 'Open') {
t.Status = 'Completed';
}
Update taskstatus;
}
Try below code sample
Regards
Ankit Gupta