2

I have been trying to prevent an attachment of type pdf while sending emails within Cases. I create an email, attach a pdf document. The process builder fires on Email creation which in turn calls a flow. The HasAttachment on email returns true. However when i check for attachement ids, it returns null. The reason being, during the process of sending the email. the attachment is temporarily created with the following prefix 0F0 which stands for EmailTempAttachmentMap, but i cannot access this object in a flow. So cannot prevent this type of attachment. Once the email is sent, the attachment object changes prefix to 00P which is the standard prefix for attachments and I can go and delete these using a flow. But i want to prevent attachement of a certain type being added during the send and not after.

Has anybody faced this issue. Salesforce support has not been able to solve it either.

4
  • If you use Apex code, you should be able to detect the pdf file type. Not sure if you can pull off this kind of check in Process Builder or Flows... Jul 14, 2019 at 7:28
  • we have gone the apex way. but the problem we are facing is. the email attachment is not technically attached to the email while the email is being sent. it only gets the attachment prefix of 00P once the email is already sent. During the sending, it has a prefix of '0F0' which is EmailTempAttachmentMap and we are not able to access that object in a trigger or an Apex class. Seems to be depreciated but not sure. Is there a way to acces that object: EmailTempAttachmentMap and does it have any relationship to Email at the time of sending. Jul 14, 2019 at 7:42
  • Got it, this is a good question, I'm not sure how to catch this Jul 14, 2019 at 12:15
  • @downtoplanet - We ran into a similar situation (but prevent users from sending email with attachment if the size is > 3MB, basically don't want to send public links in place of attachment), Have you figured out the solution or object that needs to have the validation? Validation rule on EmailMessage doesn't do anything related to attachment (other than HasAttachment boolean check). Dec 17, 2020 at 19:51

1 Answer 1

0

Since this is on Case, that would mean you're using the EmailMessage object. In order to send/save the outbound message, it would seem the record would need to pass any validation rules you created for it. With the being the situation, I don't see why creating a validation rule for EmailMessage records sent where ParentId = CaseId, couldn't be required not to have an attachment with mime type="text/PDF". That's how I would recommend approaching solving this issue.

You must log in to answer this question.

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