function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
federico_vela_pfederico_vela_p 

Email Templates

Hello,

is it now possible to access the email templates from the API???

Thank you.
benjasikbenjasik
It's on the roadmap.  What specifically are you trying to do?
 
federico_vela_pfederico_vela_p
Hi Benji,

Thanks for your reply ...

I am automating the process of converting contacts to users ... i would like to do this through an SControl with AJAX

When the user is created ... an email should be sent out with their username and password ... according to a template ....

so i have two problems :

how do i store the email template?
    i can store it in a flat file somewhere ....  :-(
    Is it possible to avoid doing the templating by hand? (filling in the fields with actual data)

How do i send the email?
    AJAX has no built in functionality.
    Could have AJAX post a request to a .jsp in my server and then the JSP would send the email .. but how do i authenticate?
          does an scontrol know who is the currently logged in user????

thank you for your time and consideration..

best regards,

Federico Vela
t anthonyt anthony
I am not an expert but we have a number of custom links(url's) that accomplish sending an email using an email template and automaticaly sending. You should be able to have your scontrol create a return url that will send your email to the user.

You should also be able to do what you want in the Scontrol. Here is a link to an app exchange scontrol that has some of the functionality you looking to use. this one updates a text field and automaticaly sends an email to a contact using an email template based on Case details.

http://www.salesforce.com/appexchange/detail_overview.jsp?NavCode__c=a0130000006P6IoAAK-2&id=a03300000022vHyAAI

here is the section i think you'd need...

hth


Code:
function sendEmail() { // use a hardcoded template id, will be fixed up at install time
/*
/email/author/emailauthor.jsp—retURL=%2F500x0000000UOlh&p3_lkid=500x0000000UOlh&rtype=003&p2_lkid=003x0000004Ezrj&save=1&p24=xxxxx@salesforce.com&p4=&p5=
the first one, retURL=%2F500x0000000UO1h is where to go back to.
It is URL-escaped, (the %2F is the '/') so it will actually go back to /500x0000000UO1h, which is a case.
if you are creating a weblink from say, a case, you would want the caseId mergeField in place of the 500x0000000UO1h.

the 2nd parameter: p3_lkid=500x0000000UOlh
that is the WHAT for the email. Substitute the ID for a case, account, solution ID.

the 3rd parameter: p2_lkid=003x0000004Ezrj
that is the WHO for the email. Substitute the ID for any contact's ID.

Aha, the save=1. yes you need that.

But you also need the p24=xxxx@salesforce.com.
This is the "Additional To:" field. You can
pass in any email address you want in there. The emaill will be sent to this address, in ADDITION
to the WHO. You can pass in more than one address here by delimiting them with a semi-colon: ';'
p4 and p5 are CC and BCC addresses. If you are missing p24, p4, and p5, you'll get an error.

*/
// to avoid hitting a limit on what we can pass to emailauthor, use a template to load the
// history text into the body
var tid = "00X30000000r2VW"; // hard code reference to template as we cant' look up templates with AJAX
var url = "/email/author/emailauthor.jsp–p3_lkid={!Case_ID}&rtype=003&p2_lkid={!Case_Contact_ID}&"+
"save=1&p24=&p4=&p5=&template_id="+tid+"&new_template=1";
var resp = new Sforce.XMLDOMFile(url);
// check return found in resp˜

} 

 

Message Edited by t anthony on 08-28-2006 01:01 PM

federico_vela_pfederico_vela_p
Thank you Anthony for your reply.

Unfortunately, that specific functionality is not supported by SalesForce, and may be discontinued or changed without prior notice.

I cannot take that risk. So i've decided to program this by hand.

I'm almost done, if someone would like to see some code let me know.

Thanks Anthony!!!

Federico Vela
adyantadyant
Hi Federico,

Were you able to successfully implement it? If you would be willing to share your code, can yu email the same at piyushNOSPAMideactiveDOTin. Replace NOSPAM with @ an DOT with .

Thanks in advance.

- Piyush
Rasmus MenckeRasmus Mencke
We have both "EmailTemplate" in our API's and sendEmailAPI.
 
For sending the email; you can create an email object extend it to send either singleEmails or MassEmails.
 
For singleEmails you can create your own content, you will be able to send up to 10 email addresses at a time.
 
For MassEmails you can send templates to contacts or leads; the limit matches the limit we have in the app today. You will be able to send to 250 contacts or leads in one batch.
 
All emails sent through the API will count against your orgs daily mass email limit.
 
We will be relasing standard AJAX functions in late March. It is accesisible through webservices.
 
-Rasmus
SuperfellSuperfell
Well, we'll have both once the Spring Release gets to your instance. (currently its deployed to Sandbox only)