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
CooldayCoolday 

Wants to show the message "Your response is already captured" when a customer replies twice on the mail.

We have a requirement where an email (Visualforce) is sent to the customer and they can either reply Accept or Reject and that response is captured in salesforce and based on that we are sending a reverse email using salesforce sites which has an Visualforce page for Accept and Reject response.
 
Currently we are facing an issue where a customer is able to accept or reject multiple times. So, to avoid that we want to show a message to the customer that "Your response is already captured".
 
How can this be achieved? 
Sumit Mishra 47Sumit Mishra 47

Use an inbound email handler , there you will have access to 'messaging.InboundEmail'  email

e.g

global messaging.InboundEmailresult handleInboundEmail(messaging.InboundEmail email, messaging.InboundEnvelope envelope) {

using email record find all parents

SELECT id, RelatedToId, HtmlBody, TextBody, FromAddress, CreatedById, CreatedBy.Email, createdBy.SenderEmail
        FROM EmailMessage
        WHERE ThreadIdentifier IN :email.references
        ORDER BY createddate ASC

 

depending upon a scenario you can add validation here post reading the related messages to the thread.