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
SFDC pvSFDC pv 

how to check if the email template has an attachment in salesforce

Sai PraveenSai Praveen (Salesforce Developers) 
Hi ,

This is the piece of apex code which we can use to find out the email template has the attachment or not.
 
EmailTemplate etemp = [select id from EmailTemplate where developerName = 'SupportCaseResponse' limit 1];

Attachment[] a = [select id,ContentType, Body From Attachment where parentId = :e.Id];
system.debug('attachement'+a);

If this solution helps, Please mark it as best answer.

Thanks,
 
Suraj Tripathi 47Suraj Tripathi 47
Hi SFDC,

You can click on 'Search Document'link in the attachment pop-up and attach a file from the Documents repository of Salesforce. 
you can get references from this link:
https://developer.salesforce.com/forums/?id=906F00000008yqDIAQ

If you find your Solution then mark this as the best answer.

Thank you!

Regards,
Suraj Tripathi