When creating a Lead through the UI, the system is sending a New Lead Alert to the New lead owner.
However, I discovered, that if using Email Services - that New Lead alert is NOT been sent.
- Anyone knows if this is a bug or by design?
- Do I need to update my Email service?
Here is the relevant class.
- Is the automated respons needs to go by: the
insert lead
line? or the fact that I have set the
lead.OwnerId
actually disables the assignment rules I have?try{ mToAddressBefore = envelope.toAddress.subString(0,envelope.toAddress.indexOf('@')); mParams = mToAddressBefore.split('\\.'); mFromEmail = email.fromAddress; // Get the user id User u1 = [SELECT Id FROM User WHERE Alias = :mParams[1]]; mCaseObject = mParams[0]; if (mCaseObject == 'lead'){ lead = new Lead(); lead.LastName = mFromEmail.subString(0,mFromEmail.indexOf('@')); lead.Company = mFromEmail; lead.OwnerId = u1.Id; lead.LeadSource = mParams[2]; lead.Email = mFromEmail; lead.RequirementsDescription__c = email.subject + '\\n' + email.plainTextBody; insert lead; result.success = true; } else if (mCaseObject == 'case'){ result.success = true; } else { result.success = false; } }catch(Exception e){ // result.success = false; // result.message = 'Oops, I failed. **' + mFromEmail + '**' + mParams[1] + '**' + sourcetext + '**'; } return result;
The leads are assigned correctly ( I set the owner within the email lead name - u1.Id)
The problem is that the email notification is not sent, again, this is only when the email service is used. Not when doing a regular new lead creation using the UI.