I know that there is a web to lead form I can create to do something similar, but is there an easy way to get the inbound email address which can be monitored and the data from the email can be attached to a field in a custom object?

In short

User emails ---> salesforce@customemail.com --> pick the content in the email body --> store it in account's description field

The whole idea is that the EMT's do not want to log into SF to update a description field and all they want to do is something similar to what approval process have. Email approve, reject and the status is updated on the approval process Thanks in advance for any pointers


Email Services are one way to do this. Given the following example, you'd be able to send an email whose subject is the Account Id, body is the Account Name, and it would update accordingly:

  1. create a new Apex class "AccountUpdateEmailHandler" containing this code:

    global class AccountUpdateEmailHandler implements Messaging.InboundEmailHandler {
      global Messaging.InboundEmailResult handleInboundEmail(
      Messaging.InboundEmail email,
      Messaging.InboundEnvelope envelope)
        String subject = email.subject;
        Pattern idPattern = Pattern.compile('001[A-Za-z0-9]{12}');
        Matcher matcher = idPattern.matcher(subject);
        if (!matcher.find()) System.assert(false, 'No Account Id in subject!');
        Account account = [SELECT Name FROM Account WHERE Id = :matcher.group(0)];
        account.Name = email.plainTextBody;
        update account;
        Messaging.InboundEmailresult result = new Messaging.InboundEmailResult();
        result.message = 'Account Name is now ' + account.Name;
        return result;
  2. from Setup > Develop > Email Services, create one using the above class and Activate it,

  3. create an "AccountUpdate" Service Address, configure "Accept Email From" and try sending to it,

Some explanation:

  • up top, the regular expression extracts the Account Id string like 001000000000abc,
  • we update the Name field as required, using the email body,
  • optionally email a response back to you so that you know what was updated,

Sure, what you want to look at is an Apex Inbound Email Handler. You can parse the email and create or update records based on the email content.



An inbound email handler can be written to achieve this.May be you may use from email id to identify the record that needs to be updated


Sorry I know this post is a bit old. But after coming across this post here earlier on, we finally decided to use Parserr, which helps you parse incoming emails and attachments.

As I said in my other post, we had to extract row data (lead per row) from Excel using Parserr. But they do email parsing too.

Full disclosure - through talking to the founder of the business, Im happy to vouch for them and help them along. Which is what Im doing here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.