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
Jay Parikh 36Jay Parikh 36 

getting accountids from using query or apex trigger

Hi i have Lead Source object and acount object which are look up relation and on Lead source object i have email address field which take email address from lead source find accountid which is related with account and take that accountids and update the field on lead source called account ids i have written apex trigger but now i am not sure how i will assign query result to that field here is a my code :
trigger leadsourcewithaccountidsupdate on Lead_Sources__c (after update ) {
set <id> accountids = new set <id>();
set <string> emailname = new set <string>();
    
    for (Lead_Sources__c ls : trigger.new){
        if(ls.Email_at_last_edit__c	 != null){
            emailname.add(ls.Email_at_last_edit__c);
            system.debug('------debug1'+emailname);
        }
        
    }
    if (emailname.size()>0){
      Account[] updates = [select id   from account where PersonEmail in : emailname ];  
      system.debug('------debug2'+updates);
      
   }
}