You need to sign in to do that
Don't have an account?
vin2sf
Send Mass Email through Apex getting getTargetObjectId=null
Hi,
Could anyone help me to find why i am getting getTargetObjectId=null though getTargetObjectId has value?
Please find the code to send mass email
messages.setTargetObjectIds(contactIds);
System.debug('contactids:'+contactIds);System.debug('getTargetObjectIds:'+messages.getTargetObjectIds());
List<Messaging.SendEmailResult> resultList = Messaging.sendEmail(new Messaging.Massemailmessage[] { messages } , false);
Please find the debug log:
20091206092244.695:Class.SurveyCandidate.sendEmail: line 162, column 9: contactids:(003A0000003IfQ0IAK, 003A0000003IfQ1IAK) 20091206092244.695:Class.SurveyCandidate.sendEmail: line 164, column 9: getTargetObjectIds:(003A0000003IfQ0IAK, 003A0000003IfQ1IAK) 20091206092244.695:Class.SurveyCandidate.sendEmail: line 168, column 9: result:(Messaging.SendEmailResult[getErrors=(Messaging.SendEmailError[getTargetObjectId=null;]);isSuccess=false;])
Regards,
vin2sf
Best Answer chosen by Admin (Salesforce Developers)
pon-de-lion
Hi, just so if anybody else might have run into the same issue, I believe it's not saying the ID is null, it's saying the e-mail address attached to that ID has problem (not valid or null...etc.), take out sendemail's second argument, or set it to true should have different error messages. hope this helps.