We have a requirement to retrieve Email-to-Case attachments using Flow. We've written an invocable action to use the EmailMessage ID and traverse the ContentDocumentLink, ContentDocument, and ContentVersion objects to retrieve the data we need.

We have a record-triggered flow on EmailMessage. The problem we're seeing is that the flow is triggered as soon as the EmailMessage record is created, but before all the Content-related records are created, so our action finds no attachments.

The action works properly if we execute it on an asynchronous flow path. Using an asynchronous call for every interview, however, seems like a bad practice. Any suggestions for how to delay the Flow interview until after all records are created?

  • Have you tried writing apex trigger on ContentDocument instead of EmailMessage object. Also ContentDocument is not accessible in Record Triggered flow, so only option I see is an apex trigger Aug 16, 2022 at 19:29

1 Answer 1


The record you need to "wait" for is ContentDocumentLink. Sadly, in V55, you can't do record-triggered flows on ContentXXX objects.

So, you have these choices

  • Async Path + invocable action (as you noted in OP)
  • Trigger on ContentDocumentLink that checks to see if LinkedEntityId is an EmailMessage.SObjectType and then finds the associated files. This would be synchronous
  • Apex Action that delegates to a queueable or future to fetch the files. Future and queueable always execute when the transaction has completed so everything will exist. You can pass the caseId to the queueable/future.

I'm not sure why you are worried about some of the logic being async - it is a fairly standard pattern

  • Regarding the async path... the concern is that we would be using an async call for every E-mail received by the org. The same concern exists using queueable or future methods. Async calls are subject to daily governor limits. For a large customer making heavy use of Email-to-Case, for example, I would prefer not to impact their resource limits if I can avoid it. Aug 17, 2022 at 13:26
  • fair enough, limit is 250,000 (or higher) - maybe a future SFDC version will enable record-triggered flows on ContentDocumentLink
    – cropredy
    Aug 17, 2022 at 17:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .