You need to sign in to do that
Don't have an account?
VSK98
WHY Can't I Use SetTargetObjectId(UserId) and SetWhatId?
Hi,
I am calling template in mail method, SetTargetObjectId(UserId) and SetWhatId(Record id)
If i use SetWhatId(Record id) getting error Invalid_ID_Field
Please help me out
Advance Thanks
Siv
I am calling template in mail method, SetTargetObjectId(UserId) and SetWhatId(Record id)
If i use SetWhatId(Record id) getting error Invalid_ID_Field
Please help me out
Advance Thanks
Siv
Here is my code
for(CAP__c w: H1bcap) {
if(w.CAP_Business_Days_SM__c == 0 )
{
system.debug('size of the list' +H1bcap.size());
system.debug('ID**********' +w.id);
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.SetTemplateid(et.id);--------------------calling template id
mail.setSaveAsActivity(false);
mail.setTargetObjectId(w.SM_Name_r.id);-----------------User ID's
mail.setWhatid(w.id);
mail.setOrgWideEmailAddressId(owe.id);-------------------calling owa id
system.debug('IDDDDDDDDDDD*******' +owe.id);
system.debug('IDDDDDDDDDDD*******' +et.id);
mailList.add(mail);
}
}
if(mailList.size() >0)
{
Messaging.sendEmail(mailList);
}
did you ever get a reply to your question ?
found a workaround ?
thanks