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
giri rockzzzzgiri rockzzzz 

How to find list of converted leads in a trigger

EnthEnth

Can you not just interrogate the Converted boolean attribute or is there a more specific question ?

giri rockzzzzgiri rockzzzz

I want count of Converted leads.

EnthEnth

OK, so you want a count of all the leads that are converted when the trigger is called or all the converted leads ever ?

 

This will give you a count of all of them in the trigger batch:

 

Integer convCount = 0;
for (Lead l : trigger.new) {
   if (l.isConverted) convCount++;
}

 

 

This wil give you a count of all converted leads in the database:

 

Integer convCount = [SELECT count()FROM Lead WHERE isConverted = true];