You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this post we are going to learn about Apex Trigger to Send a Custom Visualforce Component Email Template when Record is Created on Custom Object in Salesforce.
Real time scenarios:- Write a trigger on Custom object (Registration__c) and Send a Custom Visualforce Component Email Template when Record is Created Condition is the Student Name should not be null.
<p>w3web.net is the place where you can learn step-by-step about Blog, WordPress, Salesforce Lightning Component, Lightning Web Component (LWC), Visualforce, Technical of Computer Application, Salesforce Plugin, JavaScript, Jquery, CSS, Computer and Accessories, Software Configuration, Customization, Development and much more…</p><br/><br/>
In this post we are going to learn about Apex Trigger to Send a Custom Visualforce Component Email Template when Record is Created on Custom Object in Salesforce.
Real time scenarios:- Write a trigger on Custom object (Registration__c) and Send a Custom Visualforce Component Email Template when Record is Created Condition is the Student Name should not be null.
👉 To get source code live demo link, Click Here.
Create Apex Class Trigger
Step 1:- Create Apex Class Trigger : sendCustmTemp.apxt
`TRIGGER sendCustmTemp ON Registration__c (BEFORE INSERT, BEFORE UPDATE, after INSERT, after UPDATE) {
IF(TRIGGER.isAfter && (TRIGGER.isInsert)){
FOR(Registration__c myEmail:TRIGGER.new){
}
}`
Create Apex Class controller
Step 2:- Create Apex Class : recipientsController.apxc
`public class recipientsController {
}`
Create Classic Email Templates
Step 3:- Create Classic Email Templates : emailNotifyTemp
`<messaging:emailTemplate subject="Registration Notification" recipientType="User" relatedToType="Registration__c">
<messaging:htmlEmailBody >
<c:regEmailTempVfc />
</messaging:htmlEmailBody>
</messaging:emailTemplate>`
Create Visualforce Component
Step 4:- Create Visualforce Component : regEmailTempVfc.vfc
`<apex:component controller="regTempController" access="global">
</apex:component>`
Create Visualforce Component Apex Class Controller
Step 5:- Create Apex Class : regTempController.apxc
` public class regTempController {
}`
👉 To get source code live demo link, Click Here.
The text was updated successfully, but these errors were encountered: