Difference between revisions of "SendEmailUsingTemplate"
imported>Aeric |
imported>Aeric |
||
Line 4: | Line 4: | ||
'''Prerequisites''' | '''Prerequisites''' | ||
: | :Go to '''[File:GearIcon.png]] > Objects > {Object} > Email Templates''' | ||
:Get the | :Define or find a template. | ||
:Get the ID of that template, for use in the <tt>bodyTemplateID</tt> parameter. | |||
'''Syntax''' | '''Syntax''' |
Revision as of 23:31, 12 November 2013
- Sends an Email message using the Template identified by the bodyTemplateId parameter.
Prerequisites
- Go to [File:GearIcon.png]] > Objects > {Object} > Email Templates
- Define or find a template.
- Get the ID of that template, for use in the bodyTemplateID parameter.
Syntax
- <syntaxhighlight lang="java" enclose="div">
Result result = Functions.sendEmailUsingTemplate(String objectID, String recordID,
String to, String cc, String subject, String bodyTemplateID, String attachmentTemplateIdList, String attachmentID);
</syntaxhighlight>
Parameters
- objectID
- The identifier of the related object
- recordID
- The identifier of the related record
- to
- A list of comma-separated email addresses
- cc
- A list of comma separated email addresses
- subject
- A descriptive text string
- bodyTemplateID
- ID of the template created in 'Template' object. Its template is evaluated at run time, the template variables substituted, and then sent as the body of the message.
- attachmentTemplateIdList
- A list of comma-separated print template identifiers. The template variables are evaluated at run time, their values are substituted, and the resulting documents are then sent as attachments.
- attachmentIdList
- A list of comma-separated document identifiers in your documents folder to send as attachments
- Reserved for future use. Pass an empty string, for now.
Return
- Example
- This example calls sendEmailUsingTemplate for a contact.
<syntaxhighlight lang="java" enclose="div"> String contactID = ""; String attachmentTemplateIdList = ""; String bodyTemplateID = ""; String attachmentID = "";
// Some code to populate contactID. // Populate attachmentTemplateIdList manually from the template Ids displayed in UI from Template object // Populate bodyTemplateID manually from the template Id displayed in the UI from Template object
Functions.sendEmailUsingTemplate("CONTACT", contactID, "joe.smith@acme.com,mark.smith@acme.com", "cc.smith@xyz.com", "Some subject", bodyTemplateID, attachmentTemplateIdList, attachmentID); </syntaxhighlight>