You need to sign in to do that
Don't have an account?
CotralLabWebDev
setwhatid in quote for apex email
Hi everyone,
I'm developping an automatic email in an apex class.
I'm trying to link my email to a quote with the methode setWhatId, but it don't work with quote...
Can you help me or give me another solution plese ?
This is my code:
Thanks.
I'm developping an automatic email in an apex class.
I'm trying to link my email to a quote with the methode setWhatId, but it don't work with quote...
Can you help me or give me another solution plese ?
This is my code:
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); List<String> sendTo = new List<String>(); sendTo.add('XXXX@XXXX.XXX'); mail.setToAddresses(sendTo); mail.setTargetObjectId(quote.ContactId); mail.setReplyTo('XXXX@XXXX.XXX'); mail.setTemplateId('XXXXXXXXXXXX'); mail.setwhatid(quote.Id); mail.setSaveAsActivity(true); Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
Thanks.
http://salesforce.stackexchange.com/questions/68955/singleemailmessage-setwhatid-with-quote-id
All Answers
SendEmail failed. First exception on row 0; first error: INVALID_ID_FIELD, Only accounts, assets, campaigns, cases, contracts, opportunities, orders, products, solutions and custom objects are allowed as whatId.: [whatId, MYQUOTEID]
http://salesforce.stackexchange.com/questions/68955/singleemailmessage-setwhatid-with-quote-id
Can you please help? When you say "it works" , are you able to use email template along with Quote merge fields as well? There are 2 issues with WhatId
- Associating email to quote
- Using email template with Quote merge fields
Are you able to solve 2nd issue as well? Thank you for your time.