0

16:11:34:630 USER_DEBUG [25]|DEBUG|<div dir="ltr"><br><div class="gmail_quote">---------- Weitergeleitete Nachricht ----------<br>Von: <b class="gmail_sendername">Tom Raab</b> <span dir="ltr">&lt;<a href="mailto:[email protected]">[email protected]</a>&gt;</span><br>Datum: 29. August 2017 um 14:16<br>Betreff: Test5<br>An: Tom Raab &lt;<a href="mailto:[email protected]">[email protected]</a>&gt;<br><br><br><div dir="ltr">Moin<br clear="all"><div><br></div>-- <br><div class="m_4126976594309728372gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;color:rgb(0,0,0)">Tom Raab.<br>Consultant.Projektleiter.</p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px;color:rgb(0,0,0)"><br></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;color:rgb(0,0,0)">--</p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Arial;color:rgb(210,30,30)"><b>E-Business. Seit 1995.</b><span style="color:rgb(0,0,0)"><b> </b></span><span style="color:rgb(120,30,30)"><b>Namics.</b></span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px;color:rgb(0,0,0)"><br></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;color:rgb(0,0,0)">Namics (Deutschland) GmbH, Poststraße 20, D- 20354 Hamburg<br>Direkt <a href="tel:+49%2040%2030095842" value="+494030095842" target="_blank">+49 40 30 09 58 42</a><br><a href="mailto:[email protected]" target="_blank">[email protected]</a></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px;color:rgb(0,0,0)"><br></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;color:rgb(255,255,255)"><span><a href="http://www.namics.com/?utm_source=Mailfooter&amp;utm_medium=Mail&amp;utm_term=&amp;utm_content=Website&amp;utm_campaign=Mailfooter&quot; target="_blank">namics.com</a></span>, <a href="utm_source=Mailfooter&amp;utm_medium=Mail&amp;utm_term=&amp;utm_content=Blog.Namics&amp;utm_campaign=Mailfooter" target="_blank"><span>blog.namics.com</span></a>, <a href=" target="_blank"><span>t<wbr>witter.com/namics</span></a></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px;color:rgb(0,0,0)"> </p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px;color:rgb(0,0,0)">Handelsregister B des Amtsgerichts Frankfurt am Main / Register-Nr. HRB 57721</p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px;color:rgb(0,0,0)">Sitz: Frankfurt am Main / Geschäftsführung: Dr. Bernd Schopp, Dr. Tim Dührkoop <br></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px;color:rgb(0,0,0)"> </p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;color:rgb(0,0,0)">--</p><div><br></div></div></div>

Here's my code:

global class Email2Lead implements Messaging.InboundEmailHandler {

    global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email, Messaging.InboundEnvelope env) {

        //Do not worry about this. result returned only for Salesforce Email Service process

        Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();

        //Instantiate New Lead Object
        Lead newLead = new Lead();

        //add details
        newLead.email = email.fromAddress;
        newLead.LastName = email.subject;
        newLead.company = email.subject;

         newLead.EmailtoLead__c = email.htmlBody;
         newLead.Email_Subject__c = email.subject;
         insert newLead;


        ContentNote cn = new ContentNote();
         cn.Title = email.subject;
         String body = email.htmlBody;
         cn.Content = Blob.valueOf(body.escapeHTML4());

         insert cn;

         ContentDocumentLink newCD = new ContentDocumentLink();
        newCD.ContentDocumentId = cn.Id;
        newCD.LinkedEntityId = newLead.Id;
        newCD.ShareType = 'V';
        newCD.Visibility = 'AllUsers';

        insert (newCD);
        //insert new lead

        try {
            //Insert New Lead
            Database.insert(newLead);

        }
        catch(Exception e) {
            System.debug('Exception in new Email2Lead'+e);
        }

        return result;




    }
}
1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Adrian Larson
    Aug 29, 2017 at 14:26

1 Answer 1

0

I guess you problem could be solved by fixing the syntax error on line 3. Remove the '; so the line looks like this: String body = email.htmlBody;.

Otherwise the following lines are interpreted as string where no string is expected or makes sense.

1
  • Didn't solve the problem yet. -- I posted the whole Class. Maybe that helps to understand better.
    – Tom Raab
    Aug 29, 2017 at 13:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .