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
Milo6996Milo6996 

Create task and set task status, update related account status to the same as the most recent task

Hi All

 

I am still very green when it comes to apex and need some help whilst I try and get up to speed.

 

I am a salesforce consultant that is looking to create a Trigger that allows me to do the following;

 

  • Create a task, completing a custom field called Status.
  • There is an identical field on the account objectRelate to an account.
  • When I save the task I would like it to update the {!account.Status} to be updated with the most recent {!task.status__c} value.

I have come across a similar post from 2009 but can't seem to make it work..So I have reached the stage where I am going round and round in circles....Any help would be greatly appreciated.....Can't wait until I am up to speed with apex, but until then I am afraid I will be bugging the salesforce community boards for a little longer

 

Thanks in advance

 

milo

 

 

My OwnMy Own

 

It seems like whenever you are going to update a task, which will calls a trigger on Account that will again calling the task trigger. Recursive triggers (never ending process).  Can you please verify the trigger on account, if it is updating any task? If So have the logic in common class with static variable isTaskExecuted = false initially, once the trigger is executed from Account/Task then make the variable value to true.  Now compare the same value in other trigger, if it is true then don’t call update functionality in the other trigger.   

 

 

Please correct me, If my understanding is wrong.