You need to sign in to do that
Don't have an account?
arosys
Mass Email Message from apex class
Hi
I wnat to send mass email using template .
In my template i have merge fileds of a custom object .
I am using following code to do it :
Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage(); mail.setTargetObjectIds(contactids); mail.setTemplateId('00X90000001EePt'); mail.setWhatId(SelectedId); Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });
But this gives error setWhatId method does not exist and i saw yes there is no such method.
Any alternative to achieve this ?
Thanks
Hi arosys,
You have to use below method. you missed "s".
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.
Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator
My Blog:- http://mrjavascript.blogspot.in/
I tried it also its giving following error :
Error: Compile Error: Method does not exist or incorrect signature: [Messaging.MassEmailMessage].setWhatIds(String) at line 66 column 6
You are passing string instead of ID[] in Parameter because of that it gives you error.
see below link..
MassEmailMessage Methods
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.
Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator
My Blog:- http://mrjavascript.blogspot.in/
Yes I know , at a time i want to send only one custom object .
Like My scenario is I have a list of surveys in my page .
When a user clicks for a a particular survey ,
Email should be sent to a mass of people having link of that particular survey.
I hope you are getting me.
What should i do ?
You have taken.
string SelectedId; in your code. instead of that you have to use.
ID[] SelectedId;
means ID[] datatype instead of string..
also there it written :
The values must be one of the following types:
Contract
Case
Opportunity
Product
and mine is a custom object.
Yeah.. then you can't use custom object there..
I did this :
ID SelectedId = apexpages.currentpage().getparameters().get('selected');
still its giving error :
Method does not exist or incorrect signature: [Messaging.MassEmailMessage].setWhatIds(Id)