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
iperez_geniusiperez_genius 

testing efficiency??

Code:
trigger updateLead on Task (after insert)
{
Lead[] leadsToUpdate;
Task[] taskEdit;



for (Task t: Trigger.new)
{
leadsToUpdate = [select id, SentInfoPack__c, email from lead];
taskEdit =[select whoid, subject from task];

for (Lead ltu : leadsToUpdate)
{
Lead[] leadInserts;
for (Task tsk : taskEdit)
 if ((tsk.whoid == ltu.id) && (tsk.subject == 'mailMerge266'))
{
if (ltu.SentInfoPack__c == 'no')
{
ltu.SentInfoPack__c = 'yes' ;
update ltu;
}

}

}

}

}

I wrote this code i was wondering if anyone can advise how to make it more efficient as i am not sure how well it will fair up against thousands of records.

Ilan