You need to sign in to do that
Don't have an account?

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); } }