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.

  • 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... – Brian Miller Jul 14 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. – downtoplanet Jul 14 at 7:42
  • Got it, this is a good question, I'm not sure how to catch this – Brian Miller Jul 14 at 12:15
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.