You need to sign in to do that
Don't have an account?
Yunus Kalam
Custom Button to Send an generated email template
Hello,
I have created a custom button on Opportunity. The custom button has following javascript code. When the user clicks on the button the email should be sent. and it is working fine. But I am not able to see the fields which is bind on template. How can i show or generate opportunity fields on email ?
Any suggestion would be helpful.
Thank you in Advance,
Yunus Kalam
I have created a custom button on Opportunity. The custom button has following javascript code. When the user clicks on the button the email should be sent. and it is working fine. But I am not able to see the fields which is bind on template. How can i show or generate opportunity fields on email ?
Any suggestion would be helpful.
Thank you in Advance,
Yunus Kalam
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} (function() { sforce.connection.sessionId = "{!$Api.Session_ID}"; var message = new sforce.SingleEmailMessage(); message.targetObjectId = "{!Opportunity.ContactId__c}"; message.templateId = "00X7E000000EF6w"; message.saveAsActivity = true; var result = sforce.connection.sendEmail([message]); if(result[0].success == 'true') { alert("Email has sent succesfully..."); } else { alert("Failed..."); } alert(result); }());
WhatId is missing in your JS code.
All Answers
If i understood right then you want to include opportunity fields on email template. then you need to edit the email template as you have template id message.templateId = "00X7E000000EF6w"; you can edit the template body and include those.
revert back if you have different problem.
Thanks!
WhatId is missing in your JS code.
Regards,
Yunus Kalam