Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

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,
share|improve this answer
add comment

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.

share|improve this answer
add comment

http://blog.jeffdouglas.com/2010/03/12/writing-an-inbound-email-service-for-salesforce-com/

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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