+ Start a Discussion

Calling a Lead Id that is Used for Email Attachment

So I have a trigger based off of a VF page and need to send a bunch of fields from that page in an email pdf attachment. The email is sending with a blank pdf because it isnt retrieving any id for that lead. How do I correctly call the lead?

This code apparently doesnt work Error - Compile Error: Method does not exist or incorrect signature: lead.getId() at line 6 column 13



trigger mhform on Lead (after insert) { Messaging.SingleEmailMessage mail= new Messaging.SingleEmailMessage(); String[] toAddresses = new String[]{'margiro@piab.com'}; mail.setToAddresses(toAddresses); mail.setTemplateId('00X400000016by4'); string i = lead.getId(); mail.settargetObjectId(i); mail.setReplyTo('support@acme.com'); mail.setSenderDisplayName('Piab Support'); mail.setSaveAsActivity(false); mail.setBccSender(false); mail.setUseSignature(false); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail}); }