Created
October 20, 2019 10:12
-
-
Save sudikrt/4a3e1799fadc66c03485cba41b026bf2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class EmailToLead implements Messaging.InboundEmailHandler { | |
global Messaging.InboundEmailResult handleInboundEmail (Messaging.InboundEmail email, Messaging.InboundEnvelope envelop ) { | |
Messaging.InboundEmailResult res = new Messaging.InboundEmailResult (); | |
Lead leadData = new Lead (); | |
leadData.LastName = 'Email TO lead'; | |
leadData.Company = 'Email2Lead'; | |
leadData.Email = email.fromAddress; | |
leadData.TTSApp__StartDate__c = System.now(); | |
leadData.TTSApp__EndDate__c = System.now().addDays(10); | |
try { | |
DataBase.insert (leadData); | |
} catch (Exception e) { | |
System.debug('Email2Lead exception :' + e); | |
} | |
return res; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment