You need to sign in to do that
Don't have an account?
Ti Saunders 8
Task Trigger to Change Open Tasks "Assigned to" to New Contact Owner
I am wanting to change the "assigned to" value in open (i.e. not closed) activities whenever the parent record owner changes. Our marketing automation system is automatically creating a bulk of tasks and assigning them to the current contact owner, but a few hours later a mass contact reassignment is happening and these tasks are not getting assigned to the new contact owner.
Desired functionality:
1. Contact Owner changes
2. Related open activities (tasks) are reassigned to new contact owner
-end-
Thanks in advance for your help.
Desired functionality:
1. Contact Owner changes
2. Related open activities (tasks) are reassigned to new contact owner
-end-
Thanks in advance for your help.
Thank you for your response. This is true when manually changing the record owner, but not when doing bulk entry (e.g. data loader).
Ok, I got your point. Please use the below code and let me know if it works for your use case.
I have written an after update trigger on contact which checks 2 things:
1) Whether the process is running in bulk
2) If the owner of contact is changed
If both the conditions are met, it updates the owner of all the tasks present under that contact. You may need to add more conditions in the query in the batch class to satisfy your business use case.
Thanks,
Ravi
Management is now telling me they would like to have this restricted to only tasks that begin with "TPP". Is there a way to add that condition in here. Sorry for the late reply here. Things have been a little crazy over here this week.
Sorry for the late reply. If you want to restrict to only tasks that begin with "TPP", you can add a condition in the SOQL query to get only matching records.
Please mark it as the best answer if it solves your problem. Thanks.
Last question. Would I make 3 separate contact triggers for this, or combine eveything into a single one?
The first is a Contact trigger.
The second and third would be put under Apex Classes.
I am running into a problem though. The Apex classes went in fine, but I am getting this error when adding the Contact Trigger: "Error: Compile Error: Variable does not exist: executeHandleAfterUpdate at line 4 column 34"
Please use below code for Contact trigger:
I have all of this in here and it does not appear to be working.
I have this in my sandbox and did a bulk record update and none of the tasks are transferring when the owner changes.