Newer Version Available

This content describes an older version of this product. View Latest

EmailHeader

The Salesforce user interface allows you to specify whether to send an email when these events occur: In API versions 8.0 and later, you can also send an API request that sends email.
A group event is an Event for which IsGroupEvent is true. The EventRelation object tracks the users, leads, or contacts that are invited to a group event. Note the following behaviors for group event email sent through the API:
  • Sending a group event invitation to a IUser respects the triggerUserEmail option
  • Sending a group event invitation to a Lead or Contact respects the triggerOtherEmail option
  • Email sent when updating or deleting a group event also respect triggerUserEmail and triggerOtherEmail, as appropriate

Fields

Element Name Type Description
triggerAutoResponseEmail boolean

Indicates whether to trigger auto-response rules (true) or not (false), for leads and cases. In the Salesforce user interface, this email can be automatically triggered by a number of events, for example creating a case or resetting a user password. If this value is set to true, when a Case is created, if there is an email address for the contact specified in ContactId, the email is sent to that address. If not, the email is sent to the address specified in SuppliedEmail.

triggerOtherEmail boolean

Indicates whether to trigger email outside the organization (true) or not (false). In the Salesforce user interface, this email can be automatically triggered by creating, editing, or deleting a contact for a case.

triggerUserEmail boolean

Indicates whether to trigger email that is sent to users in the organization (true) or not (false). In the Salesforce user interface, this email can be automatically triggered by a number of events; resetting a password, creating a new user, or adding comments to a case.

Sample Code—Java

This sample shows how to use the EmailHeader. It sets the triggerAutoResponseEmail email header field to true, which triggers an email to be sent when a case is created. Next, it creates a case. This sample assumes an auto-response rule has been set for cases, and an email address is specified in the contact referenced by ContactId.

1public void createCaseWithAutoResponse(String contactId) {
2  try {
3    connection.setEmailHeader(true, false, false);
4    Case c = new Case();
5    c.setSubject("Sample Subject");
6    c.setContactId(contactId);
7    SaveResult[] sr = connection.create(new SObject[] { c });
8    // Parse sr array to see if case was created successfully.
9  } catch (ConnectionException ce) {
10    ce.printStackTrace();
11  }
12}