You need to sign in to do that
Don't have an account?
Joe Doyle
How do I make a Workflow Email Alert using fields from a VisualForce Page?
I am trying to create an email template to be sent after a form is completed. I want to configure it where if any parts of the form are not completed, it will include that in the email.
For example, lets say the form contains your Birthday, Favorite Coffee, and Favorite sports team. If a person fills out the form but doesn't complete the Birthday and Favorite sports team, I want to include that in the email. It would then say, "Thanks for completing the form. Please complete the following areas: Birthday and Favorite Sports Team.
I was just told that I can find these fields on a VisualForce page. If there anything I need to know when I create the template if I'm working with a VisualForce Page? Is it any different from creating an Email Alert from an object that isn't a VisualForce page?
For example, lets say the form contains your Birthday, Favorite Coffee, and Favorite sports team. If a person fills out the form but doesn't complete the Birthday and Favorite sports team, I want to include that in the email. It would then say, "Thanks for completing the form. Please complete the following areas: Birthday and Favorite Sports Team.
I was just told that I can find these fields on a VisualForce page. If there anything I need to know when I create the template if I'm working with a VisualForce Page? Is it any different from creating an Email Alert from an object that isn't a VisualForce page?
You would be doing the following
1. If you already dont have an Apex Controller class for your Page, create an Apex Controller
2. In your Apex Controller add a method that is fired on form submission to get all the fields that are not filled.
3. The same method will send an Email using SingleEmailMessage class available out of the box.
4. You can construct your own body that can be sent in the Email in your Apex Controller, add the fields that are not populated and send an email.
Hope this gives some clarity. For SingleEmailMessage usage examples. please see the following
http://www.forcetree.com/2009/07/sending-email-from-your-apex-class.html
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_email_outbound_single.htm