You need to sign in to do that
Don't have an account?
Lukesh Karmore
receiving an empty email body after merging fields
i merge below fields,but not receive in email
Hii,{!Contact.Name}
Your Order has been proceed
Your order detail is below.
Product Name:{!Product2.Name}
Product Code:{!Product2.code}
Unit Price:{!OpportunityLineItem.UnitPrice}
List Price:{!OpportunityLineItem.ListPrice}
Discount:{!OpportunityLineItem.Discount}
Thanks
{!Contact.Name}
Hii,{!Contact.Name}
Your Order has been proceed
Your order detail is below.
Product Name:{!Product2.Name}
Product Code:{!Product2.code}
Unit Price:{!OpportunityLineItem.UnitPrice}
List Price:{!OpportunityLineItem.ListPrice}
Discount:{!OpportunityLineItem.Discount}
Thanks
{!Contact.Name}
Looks like related to record is not getting set while sending the email. Try to test it from email template by selecting sample 'Related To' records.
Thanks
Can you send the complete, i will check where it is failed
and above image is ,email i received and merge fields:
you can checked it:
trigger question13 on OpportunityLineItem (after insert) {
set<id> myid=new set<id>();
for(OpportunityLineItem oli:Trigger.new){
myId.add(oli.OpportunityId);
}
list<opportunity> opplist=[select id,account.name,account.Id,Account.clientcontact__c from opportunity where id in: myid];
list<Messaging.SingleEmailMessage> msglist=new list<Messaging.SingleEmailMessage>();
for(OpportunityLineItem opp: Trigger.new){
for(opportunity myopp:opplist){
Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
EmailTemplate templist=[SELECT Id, DeveloperName,subject,body FROM EmailTemplate WHERE DeveloperName='question_13_trigger2' limit 1];
message.setTemplateId(templist.Id);
message.setTargetObjectId(myopp.Account.clientcontact__c);
msglist.add(message);
}
}
if(!msglist.isEmpty()){
Messaging.sendEmail(msglist);
}
}1