Skip to main content

Not sure if this is the right group to post this in but figured the folks monitoring these threads have the most insight into email threading functionality. Summer '24 brings us, if I understand it correctly, a feature that I believe could have a major impact on tracking emails sent to and from objects other than Cases, specifically Use Threading Tokens in Emails. 

 

I am attempting to set a flow up that sends an email notification about something from a custom object that is related to a Case. Correct me if I am wrong, but I was hoping this new functionality would allow a record of that email to be shown either on the object record that triggered it, or the related Case. Per this article, I have the following configured in Send Email:

 

  • Email Template Id (that I got with a Get Records)
  • Log Email on Send set to True
  • Recipient ID is Contact on triggering record
  • Related Record ID--the Case ID that is related to this custom object
  • Sender Email Address
  • Sender Type

But in reading further per below this isn't exactly plug-and-play; it needs an Apex Email Service created for it to work? 

 

"If the related record is a case, Email-to-Case processes email replies automatically. Salesforce now also supports threading for other types of objects. To process incoming emails containing tokens that aren’t cases, create an Apex Email Service and use the EmailMessages.getRecordIdFromEmail function to find the record that matches the token. For example, if you’re implementing approval processing and you’ve provided a Related Record ID of a PurchaseRequest custom object record, use the Apex Email Service to retrieve the recordId and pass it to an autolaunched flow."

 

So if I figured out (or had someone help me) create the Apex Email Service, do I call that from the flow somehow instead of the settings I have in place? Does anyone have an example of how this should be configured for a custom object? Am I even close in thinking about how this should work?

 

Or what exactly is the expected outcome for this functionality?

 

P.S. I can see in the Activity Capture on the Contact that an email was sent, but don't want to send my internal users to the Contact record if they can simply see the email that was associated with the triggering  object. 

3 件のコメント
  1. 2025年8月6日 3:20

    I finally figured out this feature. It might be really late reply though. 

    1. Make sure your custom object its Track Activities feature is enabled 

    2. Use Send email Action by flow (any type of flow), which adds Thread Token 

    3. Create Apex Email Service class and configure Apex Email Service 

    3.1. Inside Apex class, it needs to get thread token by `getRecordIdFromEmail` method 

    3.2. Refer to the sample code;

    https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_System_EmailMessages_getRecordIdFromEmail.htm

     

    you need to replace the following because `parentId` is for only Case RecordId.

    // ParentId = caseId

    RelatedToId = recordId // RecordId is the Id returns by getRecordIdFromEmail

    4. Test sending email from Custom Object by flow.  

    5. Replies are linked to your custom object Id.

0/9000