• Luca Debellis
  • NEWBIE
  • 20 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Implement a batch that counts the accounts and sends an email with the account number, thanks at all.

Trigger is : 

trigger TaskTrigger on Task (after update) {

          
          Map<Id,Id> ownerIds = new Map<Id,Id>();
        list <Lead> LeadList = new list <lead>();
        
    
    for(Task t:Trigger.new){
                Task TOld = trigger.oldMap.get(T.Id);
                String id = String.valueOf(t.WhoId);
                if(t.OwnerId != Told.Ownerid && id.startsWith('00Q'))
                  LeadList.add( new Lead(id = id, ownerid=t.OwnerId));
            }
    update LeadList;
    
}

Implement a batch that counts the accounts and sends an email with the account number, thanks at all.