• Benjamin Himley
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 5
    Replies
I don't understand why I am getting this error.  Here is the complete log:
32.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
10:30:37.263 (263907621)|EXECUTION_STARTED
10:30:37.263 (263940254)|CODE_UNIT_STARTED|[EXTERNAL]|01pq0000000Cj18|NmsEmailToLead.handleInboundEmail
10:30:37.284 (284410087)|METHOD_ENTRY|[1]|01pq0000000Cj18|NmsEmailToLead.NmsEmailToLead()
10:30:37.284 (284422003)|METHOD_EXIT|[1]|NmsEmailToLead
10:30:37.284 (284569375)|SYSTEM_CONSTRUCTOR_ENTRY|[8]|<init>()
10:30:37.284 (284622984)|SYSTEM_CONSTRUCTOR_EXIT|[8]|<init>()
10:30:37.284 (284670613)|SYSTEM_METHOD_ENTRY|[11]|String.split(String, Integer)
10:30:37.284 (284744945)|SYSTEM_METHOD_EXIT|[11]|String.split(String, Integer)
10:30:37.284 (284774622)|SYSTEM_METHOD_ENTRY|[13]|String.substring(Integer)
10:30:37.284 (284807102)|SYSTEM_METHOD_EXIT|[13]|String.substring(Integer)
10:30:37.284 (284824793)|SYSTEM_METHOD_ENTRY|[15]|String.substring(Integer)
10:30:37.284 (284850538)|SYSTEM_METHOD_EXIT|[15]|String.substring(Integer)
10:30:37.284 (284867266)|SYSTEM_METHOD_ENTRY|[17]|String.substring(Integer)
10:30:37.284 (284892403)|SYSTEM_METHOD_EXIT|[17]|String.substring(Integer)
10:30:37.284 (284909119)|SYSTEM_METHOD_ENTRY|[19]|String.substring(Integer)
10:30:37.284 (284933651)|SYSTEM_METHOD_EXIT|[19]|String.substring(Integer)
10:30:37.284 (284949903)|SYSTEM_METHOD_ENTRY|[21]|String.substring(Integer)
10:30:37.284 (284974465)|SYSTEM_METHOD_EXIT|[21]|String.substring(Integer)
10:30:37.284 (284991120)|SYSTEM_METHOD_ENTRY|[23]|String.substring(Integer)
10:30:37.285 (285015862)|SYSTEM_METHOD_EXIT|[23]|String.substring(Integer)
10:30:37.285 (285033172)|SYSTEM_METHOD_ENTRY|[25]|String.substring(Integer)
10:30:37.285 (285058320)|SYSTEM_METHOD_EXIT|[25]|String.substring(Integer)
10:30:37.285 (285074034)|SYSTEM_METHOD_ENTRY|[27]|String.substring(Integer)
10:30:37.285 (285098907)|SYSTEM_METHOD_EXIT|[27]|String.substring(Integer)
10:30:37.285 (285114697)|SYSTEM_METHOD_ENTRY|[29]|String.substring(Integer)
10:30:37.285 (285157541)|SYSTEM_METHOD_EXIT|[29]|String.substring(Integer)
10:30:37.285 (285178290)|SYSTEM_METHOD_ENTRY|[31]|String.substring(Integer)
10:30:37.285 (285206865)|SYSTEM_METHOD_EXIT|[31]|String.substring(Integer)
10:30:37.285 (285223675)|SYSTEM_METHOD_ENTRY|[33]|String.substring(Integer)
10:30:37.285 (285248702)|SYSTEM_METHOD_EXIT|[33]|String.substring(Integer)
10:30:37.285 (285265007)|SYSTEM_METHOD_ENTRY|[35]|String.substring(Integer)
10:30:37.285 (285289711)|SYSTEM_METHOD_EXIT|[35]|String.substring(Integer)
10:30:37.285 (285306118)|SYSTEM_METHOD_ENTRY|[37]|String.substring(Integer)
10:30:37.285 (285330949)|SYSTEM_METHOD_EXIT|[37]|String.substring(Integer)
10:30:37.285 (285429010)|SYSTEM_CONSTRUCTOR_ENTRY|[40]|<init>(Integer)
10:30:37.285 (285464674)|SYSTEM_CONSTRUCTOR_EXIT|[40]|<init>(Integer)
10:30:37.285 (285485674)|SYSTEM_METHOD_ENTRY|[43]|Schema.getGlobalDescribe()
10:30:37.363 (363983265)|SYSTEM_METHOD_EXIT|[43]|Schema.getGlobalDescribe()
10:30:37.364 (364042278)|SYSTEM_METHOD_ENTRY|[44]|MAP<String,Schema.SObjectType>.get(Object)
10:30:37.364 (364093964)|SYSTEM_METHOD_EXIT|[44]|MAP<String,Schema.SObjectType>.get(Object)
10:30:37.364 (364130690)|SYSTEM_METHOD_ENTRY|[45]|Schema.SObjectType.getDescribe()
10:30:37.383 (383962420)|SYSTEM_METHOD_EXIT|[45]|Schema.SObjectType.getDescribe()
10:30:37.467 (467553409)|SYSTEM_METHOD_ENTRY|[47]|MAP<String,Schema.RecordTypeInfo>.get(Object)
10:30:37.467 (467598659)|SYSTEM_METHOD_EXIT|[47]|MAP<String,Schema.RecordTypeInfo>.get(Object)
10:30:37.467 (467925873)|SYSTEM_METHOD_ENTRY|[49]|Decimal.valueOf(String)
10:30:37.468 (468297082)|SYSTEM_METHOD_EXIT|[49]|Decimal.valueOf(String)
10:30:37.471 (471184905)|FATAL_ERROR|System.TypeException: Invalid decimal:  N/A

Class.NmsEmailToLead.handleInboundEmail: line 49, column 1
10:30:37.471 (471200087)|FATAL_ERROR|System.TypeException: Invalid decimal:  N/A

Class.NmsEmailToLead.handleInboundEmail: line 49, column 1
10:30:37.868 (479865528)|CUMULATIVE_LIMIT_USAGE
10:30:37.868|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 36000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

10:30:37.868|CUMULATIVE_LIMIT_USAGE_END

10:30:37.479 (479904323)|CODE_UNIT_FINISHED|NmsEmailToLead.handleInboundEmail
10:30:37.481 (481336340)|EXECUTION_FINISHED

And here is my apex class for my email-to-lead service I'm attempting to make:
 

global class NmsEmailToLead implements Messaging.InboundEmailHandler {

  global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email,

                                                       Messaging.InboundEnvelope env){


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

    String[] emailBody = email.plainTextBody.split('\n', 0);

    String firstName = emailBody[1].substring(10);
    
    String lastName = emailBody[2].substring(10);

    String address = emailBody[3].substring(8);

    String state = emailBody[4].substring(5);

    String zipcode = emailBody[5].substring(7);

    String city = emailBody[6].substring(4);

    String leadEmail = emailBody[7].substring(12);

    String phone = emailBody[8].substring(8);

    String paymentsBehind = emailBody[11].substring(15);

    String loanAmount = emailBody[13].substring(11);

    String estimatedHomeValue = emailBody[14].substring(21);

    String creditLevel = emailBody[17].substring(12);

    String interestRate = emailBody[20].substring(14);


    Lead[] newLead = new Lead[0];

     try {
        Map<String, Schema.SObjectType> sObjectMap = Schema.getGlobalDescribe() ;
        Schema.SObjectType s = sObjectMap.get('Lead') ;
        Schema.DescribeSObjectResult resSchema = s.getDescribe() ;
        Map<String,Schema.RecordTypeInfo> recordTypeInfo = resSchema.getRecordTypeInfosByName();
        Id rtId = recordTypeInfo.get('Housing Counseling').getRecordTypeId();

       newLead.add(new Lead(RecordTypeId = rtId,
       FirstName=firstName,LastName=lastName,Phone = phone,Email = leadEmail,
       Street = address,State = state,City = city,PostalCode = zipcode,
       Payments_Behind__c = decimal.valueof(paymentsBehind),Total_Amount__c = decimal.valueof(loanAmount),
       Estimated_Home_Value__c = decimal.valueof(estimatedHomeValue),
       Credit_Level__c = creditLevel,Interest_Rate__c = decimal.valueof(interestRate)));

       insert newLead;       
    }
     
   catch (QueryException e) {
       System.debug('Lead Query Issue: ' + e);
        
   }
    

   result.success = true;

   return result;

  }

}

Thanks in advance for any help!

I'm trying to set up an email-to-lead email service where the information for the lead is in the content of the email iteself.
The leads always come from the same email to my Outlook email.  The email contains the information for the lead in its content.  I have set up an apex class, and an email service within Salesforce, and have activated the email service.  I set up a rule within outlook to automatically redirect emails to the salesforce email given in the email service. 
No new leads are bein created at all, however.  I can't figure out why.  Are there logs of some kind I could check?  In the email service I have Email Error Routing enabled, and have it set so that it sends errors to my email, but I haven't received any error emails from salesforce (although I have been having issues with receiving emails from salesforce ip's, so they might actually be getting sent).  Here is my Apex class:

global class NmsEmailToLead implements Messaging.InboundEmailHandler {

  global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email,

                                                       Messaging.InboundEnvelope env){


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

    String[] emailBody = email.plainTextBody.split('\n', 0);

    String firstName = emailBody[1].substring(10);
    
    String lastName = emailBody[2].substring(10);

    String address = emailBody[3].substring(8);

    String state = emailBody[4].substring(5);

    String zipcode = emailBody[5].substring(7);

    String city = emailBody[6].substring(4);

    String leadEmail = emailBody[7].substring(12);

    String phone = emailBody[8].substring(8);

    String paymentsBehind = emailBody[11].substring(15);

    String loanAmount = emailBody[13].substring(11);

    String estimatedHomeValue = emailBody[14].substring(21);

    String creditLevel = emailBody[17].substring(12);

    String interestRate = emailBody[20].substring(14);


    Lead[] newLead = new Lead[0];

     try {
        Map<String, Schema.SObjectType> sObjectMap = Schema.getGlobalDescribe() ;
        Schema.SObjectType s = sObjectMap.get('Lead') ;
        Schema.DescribeSObjectResult resSchema = s.getDescribe() ;
        Map<String,Schema.RecordTypeInfo> recordTypeInfo = resSchema.getRecordTypeInfosByName();
        Id rtId = recordTypeInfo.get('Housing Counseling').getRecordTypeId();

       newLead.add(new Lead(RecordTypeId = rtId,
       FirstName=firstName,LastName=lastName,Phone = phone,Email = leadEmail,
       Street = address,State = state,City = city,PostalCode = zipcode,
       Payments_Behind__c = decimal.valueof(paymentsBehind),Total_Amount__c = decimal.valueof(loanAmount),
       Estimated_Home_Value__c = decimal.valueof(estimatedHomeValue),
       Credit_Level__c = creditLevel,Interest_Rate__c = decimal.valueof(interestRate)));

       insert newLead;       
    }
     
   catch (QueryException e) {
        
   }
    

   result.success = true;

   return result;

  }

}

Any help with understanding what I am doing wrong here would be greatly appreciated, thanks!

The leads always come from the same email to my Outlook email.  The email contains the information for the lead in its content.  I have set up an apex class, and an email service within Salesforce, and have activated the email service.  I set up a rule within outlook to automatically redirect emails to the salesforce email given in the email service.  

No new leads are bein created at all, however.  I can't figure out why.  Are there logs of some kind I could check?  In the email service I have Email Error Routing enabled, and have it set so that it sends errors to my email, but I haven't received any error emails from salesforce (although I have been having issues with receiving emails from salesforce ip's, so they might actually be getting sent).  Here is my Apex code:

 

global class NmsEmailToLead implements Messaging.InboundEmailHandler {

  global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email,

                                                       Messaging.InboundEnvelope env){


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

    String[] emailBody = email.plainTextBody.split('\n', 0);

    String firstName = emailBody[1].substring(10);
    
    String lastName = emailBody[2].substring(10);

    String address = emailBody[3].substring(8);

    String state = emailBody[4].substring(5);

    String zipcode = emailBody[5].substring(7);

    String city = emailBody[6].substring(4);

    String leadEmail = emailBody[7].substring(12);

    String phone = emailBody[8].substring(8);

    String paymentsBehind = emailBody[11].substring(15);

    String loanAmount = emailBody[13].substring(11);

    String estimatedHomeValue = emailBody[14].substring(21);

    String creditLevel = emailBody[17].substring(12);

    String interestRate = emailBody[20].substring(14);


    Lead[] newLead = new Lead[0];

     try {
        Map<String, Schema.SObjectType> sObjectMap = Schema.getGlobalDescribe() ;
        Schema.SObjectType s = sObjectMap.get('Lead') ;
        Schema.DescribeSObjectResult resSchema = s.getDescribe() ;
        Map<String,Schema.RecordTypeInfo> recordTypeInfo = resSchema.getRecordTypeInfosByName();
        Id rtId = recordTypeInfo.get('Housing Counseling').getRecordTypeId();

       newLead.add(new Lead(RecordTypeId = rtId,
       FirstName=firstName,LastName=lastName,Phone = phone,Email = leadEmail,
       Street = address,State = state,City = city,PostalCode = zipcode,
       Payments_Behind__c = decimal.valueof(paymentsBehind),Total_Amount__c = decimal.valueof(loanAmount),
       Estimated_Home_Value__c = decimal.valueof(estimatedHomeValue),
       Credit_Level__c = creditLevel,Interest_Rate__c = decimal.valueof(interestRate)));

       insert newLead;       
    }
     
   catch (QueryException e) {
        
   }
    

   result.success = true;

   return result;

  }

}

Any help with understanding what I am doing wrong here would be greatly appreciated, thanks!

I see that there are multiple apps on the app exchange to do this, however, they depend on the email coming from the lead themselves.  My situation is that I am getting emails from a lead generating company, from the same email everytime, and the lead information is in the content of the email itself.  The emails always come from the same email, and the content is always formatted in the same way. 
From what I understand, I need to set up an email service, then use some kind of Apex code to pull the information from the email, then set up an email forwarding rule in my outlook account so that the emails automatically get sent to salesforce where they are then are turned into leads.  

Is this correct?  If it is, how do I do the Apex coding part?  I have a little bit of coding experience (ruby, javascript), but are there any resources besides the apex code devoloper's guide that someone could point me to?  Going through that whole guide just to write a simple email service seems a bit overkill; has anyone done something similar that I could look at and adjust to my needs?

Thanks so much in advance,

Benjamin

I don't understand why I am getting this error.  Here is the complete log:
32.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
10:30:37.263 (263907621)|EXECUTION_STARTED
10:30:37.263 (263940254)|CODE_UNIT_STARTED|[EXTERNAL]|01pq0000000Cj18|NmsEmailToLead.handleInboundEmail
10:30:37.284 (284410087)|METHOD_ENTRY|[1]|01pq0000000Cj18|NmsEmailToLead.NmsEmailToLead()
10:30:37.284 (284422003)|METHOD_EXIT|[1]|NmsEmailToLead
10:30:37.284 (284569375)|SYSTEM_CONSTRUCTOR_ENTRY|[8]|<init>()
10:30:37.284 (284622984)|SYSTEM_CONSTRUCTOR_EXIT|[8]|<init>()
10:30:37.284 (284670613)|SYSTEM_METHOD_ENTRY|[11]|String.split(String, Integer)
10:30:37.284 (284744945)|SYSTEM_METHOD_EXIT|[11]|String.split(String, Integer)
10:30:37.284 (284774622)|SYSTEM_METHOD_ENTRY|[13]|String.substring(Integer)
10:30:37.284 (284807102)|SYSTEM_METHOD_EXIT|[13]|String.substring(Integer)
10:30:37.284 (284824793)|SYSTEM_METHOD_ENTRY|[15]|String.substring(Integer)
10:30:37.284 (284850538)|SYSTEM_METHOD_EXIT|[15]|String.substring(Integer)
10:30:37.284 (284867266)|SYSTEM_METHOD_ENTRY|[17]|String.substring(Integer)
10:30:37.284 (284892403)|SYSTEM_METHOD_EXIT|[17]|String.substring(Integer)
10:30:37.284 (284909119)|SYSTEM_METHOD_ENTRY|[19]|String.substring(Integer)
10:30:37.284 (284933651)|SYSTEM_METHOD_EXIT|[19]|String.substring(Integer)
10:30:37.284 (284949903)|SYSTEM_METHOD_ENTRY|[21]|String.substring(Integer)
10:30:37.284 (284974465)|SYSTEM_METHOD_EXIT|[21]|String.substring(Integer)
10:30:37.284 (284991120)|SYSTEM_METHOD_ENTRY|[23]|String.substring(Integer)
10:30:37.285 (285015862)|SYSTEM_METHOD_EXIT|[23]|String.substring(Integer)
10:30:37.285 (285033172)|SYSTEM_METHOD_ENTRY|[25]|String.substring(Integer)
10:30:37.285 (285058320)|SYSTEM_METHOD_EXIT|[25]|String.substring(Integer)
10:30:37.285 (285074034)|SYSTEM_METHOD_ENTRY|[27]|String.substring(Integer)
10:30:37.285 (285098907)|SYSTEM_METHOD_EXIT|[27]|String.substring(Integer)
10:30:37.285 (285114697)|SYSTEM_METHOD_ENTRY|[29]|String.substring(Integer)
10:30:37.285 (285157541)|SYSTEM_METHOD_EXIT|[29]|String.substring(Integer)
10:30:37.285 (285178290)|SYSTEM_METHOD_ENTRY|[31]|String.substring(Integer)
10:30:37.285 (285206865)|SYSTEM_METHOD_EXIT|[31]|String.substring(Integer)
10:30:37.285 (285223675)|SYSTEM_METHOD_ENTRY|[33]|String.substring(Integer)
10:30:37.285 (285248702)|SYSTEM_METHOD_EXIT|[33]|String.substring(Integer)
10:30:37.285 (285265007)|SYSTEM_METHOD_ENTRY|[35]|String.substring(Integer)
10:30:37.285 (285289711)|SYSTEM_METHOD_EXIT|[35]|String.substring(Integer)
10:30:37.285 (285306118)|SYSTEM_METHOD_ENTRY|[37]|String.substring(Integer)
10:30:37.285 (285330949)|SYSTEM_METHOD_EXIT|[37]|String.substring(Integer)
10:30:37.285 (285429010)|SYSTEM_CONSTRUCTOR_ENTRY|[40]|<init>(Integer)
10:30:37.285 (285464674)|SYSTEM_CONSTRUCTOR_EXIT|[40]|<init>(Integer)
10:30:37.285 (285485674)|SYSTEM_METHOD_ENTRY|[43]|Schema.getGlobalDescribe()
10:30:37.363 (363983265)|SYSTEM_METHOD_EXIT|[43]|Schema.getGlobalDescribe()
10:30:37.364 (364042278)|SYSTEM_METHOD_ENTRY|[44]|MAP<String,Schema.SObjectType>.get(Object)
10:30:37.364 (364093964)|SYSTEM_METHOD_EXIT|[44]|MAP<String,Schema.SObjectType>.get(Object)
10:30:37.364 (364130690)|SYSTEM_METHOD_ENTRY|[45]|Schema.SObjectType.getDescribe()
10:30:37.383 (383962420)|SYSTEM_METHOD_EXIT|[45]|Schema.SObjectType.getDescribe()
10:30:37.467 (467553409)|SYSTEM_METHOD_ENTRY|[47]|MAP<String,Schema.RecordTypeInfo>.get(Object)
10:30:37.467 (467598659)|SYSTEM_METHOD_EXIT|[47]|MAP<String,Schema.RecordTypeInfo>.get(Object)
10:30:37.467 (467925873)|SYSTEM_METHOD_ENTRY|[49]|Decimal.valueOf(String)
10:30:37.468 (468297082)|SYSTEM_METHOD_EXIT|[49]|Decimal.valueOf(String)
10:30:37.471 (471184905)|FATAL_ERROR|System.TypeException: Invalid decimal:  N/A

Class.NmsEmailToLead.handleInboundEmail: line 49, column 1
10:30:37.471 (471200087)|FATAL_ERROR|System.TypeException: Invalid decimal:  N/A

Class.NmsEmailToLead.handleInboundEmail: line 49, column 1
10:30:37.868 (479865528)|CUMULATIVE_LIMIT_USAGE
10:30:37.868|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 36000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

10:30:37.868|CUMULATIVE_LIMIT_USAGE_END

10:30:37.479 (479904323)|CODE_UNIT_FINISHED|NmsEmailToLead.handleInboundEmail
10:30:37.481 (481336340)|EXECUTION_FINISHED

And here is my apex class for my email-to-lead service I'm attempting to make:
 

global class NmsEmailToLead implements Messaging.InboundEmailHandler {

  global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email,

                                                       Messaging.InboundEnvelope env){


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

    String[] emailBody = email.plainTextBody.split('\n', 0);

    String firstName = emailBody[1].substring(10);
    
    String lastName = emailBody[2].substring(10);

    String address = emailBody[3].substring(8);

    String state = emailBody[4].substring(5);

    String zipcode = emailBody[5].substring(7);

    String city = emailBody[6].substring(4);

    String leadEmail = emailBody[7].substring(12);

    String phone = emailBody[8].substring(8);

    String paymentsBehind = emailBody[11].substring(15);

    String loanAmount = emailBody[13].substring(11);

    String estimatedHomeValue = emailBody[14].substring(21);

    String creditLevel = emailBody[17].substring(12);

    String interestRate = emailBody[20].substring(14);


    Lead[] newLead = new Lead[0];

     try {
        Map<String, Schema.SObjectType> sObjectMap = Schema.getGlobalDescribe() ;
        Schema.SObjectType s = sObjectMap.get('Lead') ;
        Schema.DescribeSObjectResult resSchema = s.getDescribe() ;
        Map<String,Schema.RecordTypeInfo> recordTypeInfo = resSchema.getRecordTypeInfosByName();
        Id rtId = recordTypeInfo.get('Housing Counseling').getRecordTypeId();

       newLead.add(new Lead(RecordTypeId = rtId,
       FirstName=firstName,LastName=lastName,Phone = phone,Email = leadEmail,
       Street = address,State = state,City = city,PostalCode = zipcode,
       Payments_Behind__c = decimal.valueof(paymentsBehind),Total_Amount__c = decimal.valueof(loanAmount),
       Estimated_Home_Value__c = decimal.valueof(estimatedHomeValue),
       Credit_Level__c = creditLevel,Interest_Rate__c = decimal.valueof(interestRate)));

       insert newLead;       
    }
     
   catch (QueryException e) {
       System.debug('Lead Query Issue: ' + e);
        
   }
    

   result.success = true;

   return result;

  }

}

Thanks in advance for any help!

The leads always come from the same email to my Outlook email.  The email contains the information for the lead in its content.  I have set up an apex class, and an email service within Salesforce, and have activated the email service.  I set up a rule within outlook to automatically redirect emails to the salesforce email given in the email service.  

No new leads are bein created at all, however.  I can't figure out why.  Are there logs of some kind I could check?  In the email service I have Email Error Routing enabled, and have it set so that it sends errors to my email, but I haven't received any error emails from salesforce (although I have been having issues with receiving emails from salesforce ip's, so they might actually be getting sent).  Here is my Apex code:

 

global class NmsEmailToLead implements Messaging.InboundEmailHandler {

  global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email,

                                                       Messaging.InboundEnvelope env){


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

    String[] emailBody = email.plainTextBody.split('\n', 0);

    String firstName = emailBody[1].substring(10);
    
    String lastName = emailBody[2].substring(10);

    String address = emailBody[3].substring(8);

    String state = emailBody[4].substring(5);

    String zipcode = emailBody[5].substring(7);

    String city = emailBody[6].substring(4);

    String leadEmail = emailBody[7].substring(12);

    String phone = emailBody[8].substring(8);

    String paymentsBehind = emailBody[11].substring(15);

    String loanAmount = emailBody[13].substring(11);

    String estimatedHomeValue = emailBody[14].substring(21);

    String creditLevel = emailBody[17].substring(12);

    String interestRate = emailBody[20].substring(14);


    Lead[] newLead = new Lead[0];

     try {
        Map<String, Schema.SObjectType> sObjectMap = Schema.getGlobalDescribe() ;
        Schema.SObjectType s = sObjectMap.get('Lead') ;
        Schema.DescribeSObjectResult resSchema = s.getDescribe() ;
        Map<String,Schema.RecordTypeInfo> recordTypeInfo = resSchema.getRecordTypeInfosByName();
        Id rtId = recordTypeInfo.get('Housing Counseling').getRecordTypeId();

       newLead.add(new Lead(RecordTypeId = rtId,
       FirstName=firstName,LastName=lastName,Phone = phone,Email = leadEmail,
       Street = address,State = state,City = city,PostalCode = zipcode,
       Payments_Behind__c = decimal.valueof(paymentsBehind),Total_Amount__c = decimal.valueof(loanAmount),
       Estimated_Home_Value__c = decimal.valueof(estimatedHomeValue),
       Credit_Level__c = creditLevel,Interest_Rate__c = decimal.valueof(interestRate)));

       insert newLead;       
    }
     
   catch (QueryException e) {
        
   }
    

   result.success = true;

   return result;

  }

}

Any help with understanding what I am doing wrong here would be greatly appreciated, thanks!

I see that there are multiple apps on the app exchange to do this, however, they depend on the email coming from the lead themselves.  My situation is that I am getting emails from a lead generating company, from the same email everytime, and the lead information is in the content of the email itself.  The emails always come from the same email, and the content is always formatted in the same way. 
From what I understand, I need to set up an email service, then use some kind of Apex code to pull the information from the email, then set up an email forwarding rule in my outlook account so that the emails automatically get sent to salesforce where they are then are turned into leads.  

Is this correct?  If it is, how do I do the Apex coding part?  I have a little bit of coding experience (ruby, javascript), but are there any resources besides the apex code devoloper's guide that someone could point me to?  Going through that whole guide just to write a simple email service seems a bit overkill; has anyone done something similar that I could look at and adjust to my needs?

Thanks so much in advance,

Benjamin