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
Madhu007Madhu007 

Thread Id for Inbound email message.

Hi,
I have created one inbound email service. I have a button on custom object. Click on the button i am sending the pdf to email address which is in the record and in cc i am adding the email service id(long email id). If receipent replyied to the mail i needto attach the email message to custom object. I am doing this from inbound email service.But i want to create the attachment for a particular record. For this how can i get the id of record.

Thanks.   
Pankaj_GanwaniPankaj_Ganwani
Hi Mandhu,

Since you have to create an attachment for a particular record in Email service handler, you will have to send Record id to the sent email. You can either send it via Subject or placing the record Id at the botton of the Email body.

When User replies of the email sent, you will have to parse the Subject or Body in your inbound email handler and extract the Record Id from it to insert the attachment corresponding to that record id. This is the only solution I can think of.
Madhu007Madhu007
Hi Pankaj,

Thanks for the reply. If user is delete the subject or body then how can we capture the record id. Is there any possibilty to access thread id kind of thing.

Thanks.
Pankaj_GanwaniPankaj_Ganwani
Hi,

As mentioned in your problem statement that user will reply to the same email, right? So, the email subject will remain same if we reply for the same email. So, you don't need to bother at this front.

You can set the email subject something like this:
Subject - {record Id}
Madhu007Madhu007
Hi, 

Thanks Pankaj. You are right. User will reply to the same email only. But user can able to remove the subject or change the subject line. In this situvation how can handle. 

Thanks.
Pankaj_GanwaniPankaj_Ganwani
Hi,

If user gives reply to the same email, then subject will remain intact only body will be changed of the email. User cannot change the subject. If you want you can try in your gmail account.

Let me know if this makes sense to you.