function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
StenSten 

Update field in salesforce base on email received

What could be my best approach on this; business case: Emails to update fields in salesforce
Templates will have merged fields
Signatory first name
Signatory Last name
Date
Removal date.
it is expected that these fields will  automatically update contact fields when a reponses is received from customers. There should be a capability
of removing the signatory first and last name automatically if the customer wishes to in future with the removal date recorded
What is my best approach? can inbound emails do this? 
please options on achiving this without creating a template are also wellcome. 
I am not a core developer, detailed explanation will be much apreciated
 
Travis Malle 9Travis Malle 9
Sounds like your going to need to create an inbound email service. At a high level heres wat your gonna do
  1. from the setup menu, create a new email service. This will generate a new inbound email address that you can CC or BCC to your email that need to be evaluated. You will also need to delare an apex class that will run when said email is recieved
  2. create an apex class to do your logic processing.
Here is a basic example:
 
global class TestEmailService implements Messaging.InboundEmailHandler {


 global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email, Messaging.InboundEnvelope env){
        Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();


 string emailBody = email.htmlbody;
// Do whatever you want based on email html body
// this will take some parsing


return result;

}



Please let me know if this helps,

Travis