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
Jack VolkovJack Volkov 

Why is a task trigger getting fired upon lead conversion?

When attempting to convert a lead, that has related tasks assigned to an inactive owner, a task trigger is being fired.  This then throws the following error:  
System.DmlException: Insert failed. First exception on row 0; first error: INACTIVE_OWNER_OR_USER, operation performed with inactive user: []
What is causing the task trigger to fire?  How can this be prevented?
Neetu_BansalNeetu_Bansal
Hi Jack,

As the Lead you want to convert have associated Tasks, that's why these also gets updated while converting and attach with the newly created Account and Opportunity. This runs the task trigger.

To resolve this issue, you need to change the Assignee on Task with the Active users.

Let me know if you need any other help.

Thanks,
Neetu
Jack VolkovJack Volkov
We have a class method that converts leads when they meet certain criteria.  Through this method we are able to update a flag indicating that execution is a result of this this lead convert class, then in our task trigger we check that flag and do not run if the lead convert class is what fired the task trigger.

How can we do something similar for a manual lead conversion?  How can a method be called automatically if a lead is getting manually converted?
Jack VolkovJack Volkov
How can a class method automatically called from a manual lead conversion?