You need to sign in to do that
Don't have an account?

Email template for leads fields
Hi,
how to create email template for lead fields
I tried ,
Step 1:

Step 2:

Please tell me ,If anybody Know
how to create email template for lead fields
I tried ,
Step 1:
Step 2:
Please tell me ,If anybody Know
Steps for Visualforce Template
NewEmailTemplate->VisualforceTemplate->Enter the Details(Recipient Type -USER , Related To Type -None)->Edit Template ->Copy and paste the Above Code->Send and Test verify merge fields->Choose User(Recipient Type) , Chose Lead Record(Related To Type)->Send Email to View->Ok
Use the Above Steps to get the Proper Output.
Thanks,
Thanks,
Raj
(Sweet Potato Tec)
All Answers
It's not possible because Lead,Contact&Users are comes under the Recipient Records,
In the Recipient rceord you can declare the Lead Records so that you can retrieve the Lead merge Fields.
There is a no need to declare the Lead Records in Related To.
Use the Below Link to Refer-:
https://help.salesforce.com/apex/HTViewSolution?id=000175913&language=en_US
Let us know if there any further doubts you have?
If the answer satisfy your requirement pls choose as best Answer.
Thanks,
Raj
(Sweet Potato Tec)
I think this also gives a Some Help to you.
Instead of using the Text type Email type use the Visualforce Type Email Template.
You can do this using a visualforce email template: when creating the template, make the "Related To Type" = "Lead". Then you can pull in any of the Lead fields {For Custom Fields by using their API names in this format: {!RelatedTo.FieldAPIName__c}}
For example:
<messaging:emailTemplate subject="this is the subject" recipientType="User" relatedToType="Lead">
<messaging:plaintextEmailBody >
Full Name : {!RelatedTo.LastName}
Annual Revenue: {!RelatedTo.AnnualRevenue}
Lead Owner : {!RelatedTo.Owner}
</messaging:plainTextEmailBody>
</messaging:emailTemplate>
Steps for Visualforce Template
NewEmailTemplate->VisualforceTemplate->Enter the Details(Recipient Type -USER , Related To Type -None)->Edit Template ->Copy and paste the Above Code->Send and Test verify merge fields->Choose User(Recipient Type) , Chose Lead Record(Related To Type)->Send Email to View->Ok
Use the Above Steps to get the Proper Output.
Thanks,
Thanks,
Raj
(Sweet Potato Tec)
Thank you for your reply,
Its awesome,working
Regards,
M. sivasankari
I follwed the steps which you mentioned in the previous. I written a trigger to sent an email to the user, i added the emial template in the trigger which i have creeated but ehen an email is sent through trigger i was unable to show the lead field values in that mail. Can you help me over here.
Thanks in Advance.
Regards,
Mac.
Copy your trigger and template please !!!
Thanks,
Raj
(Sweet Potato Tec)
In trigger this line instead of using this EmailTemplate templateId = [Select id from EmailTemplate where name ='lead notification template'];
Try
EmailTemplate templateId = [Select id from EmailTemplate where Id='18 Digit Id of email template' ];
Thanks,
Raj
(Sweet Potato Tec)
Still i'm not getting the field values in the mail. Can you help me here...
EmailTemplate templateId = [Select id from EmailTemplate where Id='18 Digit Id of email template' ];
What is your requiremant why are you writing trigger?
Can you please explain ?
Thanks,
Raj
(Sweet Potato Tec)
Add a one more line after set target object id in your trigger.
mail.setwhatId(Lead.id);
Then try again and let me know what happens!!!
Thanks,
Raj
(Sweet Potato Tec)
Getting error as
method does not exist or incorrect signature: [Messaging.SingleEmailMessage].setwhatId(Schema.SObjectField)
use the mail.setTargetObjectId(leadid);
Try the below codes in your trigger.
After the 1st line insert the below one:
Set<Id> LeadIds = new Set<ID>();
Replace your mail sections by the below one:
List<Messaging.SingleEmailMessage> mails =new List<Messaging.SingleEmailMessage>();
for(Lead ld : [select id, Status,Lead_age__c, owner.email from Lead where id IN : LeadIds])
if(mapZipForEmail.containsKey(myLead.PostalCode__c))
{
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();// For Email
List<String> sendTo = new List<String>();
sendTo.add(ld.Owner.Email);//sending message via Email to the Owner of the lead
mail.setToAddresses(sendTo);
mail.setReplyTo('test@gmail.com');
mail.setSenderDisplayName('New Notification');
mail.saveAsActivity = false;
mail.setTemplateId(templateId.Id);
mail.setTargetObjectId(ld.OwnerId);
mail.setWhatId(ld.id);
mails.add(mail);
Messaging.sendEmail(mails);
}
let me know what happens!!!
Thanks,
Raj
(Sweet Potato Tec)
use ld.PostalCode__c insteadof myLead.PostalCode__c in the line 14
I'm not getting any mail after creating a lead .