You need to sign in to do that
Don't have an account?
Bill Button
Newbie: Lead assignment trigger, how to send email
I have created the following trigger and am not sure how to send an email with the details of the lead to an external email address, but I do have the email address in my custom object Assignment__c. I also would like to be able to assign some leads to a queue when no match is found. If their are any suggestions in improving the code I would be very greatful as this is my fist attempt at a trigger.
trigger AssignReseller on Lead (Before Insert) { for (Lead a : Trigger.new) { integer AssignmentRegionOnly = [select Count() from Assignment__c where Country__c = :a.Country and Region__C = :a.State]; if (AssignmentRegionOnly > 0) { Assignment__c AssignThis = [select Area_Account_Manager__c,Reseller__c from Assignment__c where Country__c = :a.Country and Region__C = :a.State]; a.OwnerId = AssignThis.Area_Account_Manager__c; a.Reseller__C = AssignThis.Reseller__C; } else { integer AssignmentRules = [select Count() from Assignment__c where Country__c = :a.Country]; if (AssignmentRules > 0) { Assignment__c AssignThis = [select Area_Account_Manager__c,Reseller__c from Assignment__c where Country__c = :a.Country]; a.OwnerId = AssignThis.Area_Account_Manager__c; a.Reseller__C = AssignThis.Reseller__C; } else { system.debug('Would like to assign lead to a queue here'); } } } }
Regards
Bill Button
Business Systems Development Manager
you're looking for 'outbound email'.
i haven't gotten to this yet, but it looks fairly straight forward.