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
Bernd NawrathBernd Nawrath 

Event email-trigger when new account is added

Hello dear community, I already have an email template as a component and I just want to create a little bit of code, that sends this email to the account when he/she is added, any tipps or advices? thanks in advance:)
Cloud Jedi SolutionsCloud Jedi Solutions
Hi Bernd,

Can you elaborate your problem? Are you trying to add a VisualForce Component into a VisualForce template?

Can you clarify what you mean by "he/she is added"? Are you planning to implement this via a workflow rule?
Bernd NawrathBernd Nawrath
@Cloud 
Hello, basically I already have a pdf as a component in the production, so all I want to do is creating an event trigger that sends this pdf as an email to a person who has been added to accounts.
Cloud Jedi SolutionsCloud Jedi Solutions
Got it. In that case all you would need to do is to create an activate a workflow rule that would use the email template to send out based on your rule requirements. Are you having issues with that?
Chidambar ReddyChidambar Reddy
Hi Bernd,


http://www.sfdc99.com/2014/03/01/sending-emails-using-apex/
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_email_outbound_single.htm
here use EmailTemplate et=[Select id from EmailTemplate where name=:'EmailTemplatename'];
and use this emailtemplate id to use the template

like mail.setTemplateId(et.id);

https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_email_outbound_base.htm#apex_classes_email_outbound_base

Thanks
choose it as best answer if it has helped you
Bernd NawrathBernd Nawrath
@Cloud yes, I already tried it but all I'm getting are exceptions, I think I just need the right query to reach out to that pdf, allowing me to send it.