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

SingleEmailMessage: Properties invalid at this location?

I am using the SingleemailMessage object to send an update email to a Contact. As you can see in the snippet below, I'm using a template for the email. This is in a custom button on the View Contact form, and contactId contains the current Contact's Id. That part is all working great.

var email = new sforce.SingleEmailMessage();

email.replyTo = "";

var a = new Array(1);
a[0] = contactId;

email.targetObjectId = a;
email.setBccSender = true;
email.setSenderDisplayName = "Member Services";
email.saveAsActivity = true;
email.templateId = templateID;
var result = sforce.connection.sendEmail([email]);

The problem is that I'm trying to use the setBccSender and setSenderDisplayName properties, but both give me an error "<property> invalid at this location".

I realize that some properties are not available when using a template, but neither of these are indicated as such in the Winter 08 Apex API reference document.

Or does "at this location" mean something different? This is the Unlimited Edition of SalesForce, so does something need to be turned on?


P.S. Thanks, SalesForce, for allowing the use of templates with the SingleEmailMessage object!