I'm need to create email in Sales Force with the recipient as a custom object rather than a User, Contact or Person. Unfortunately, it appears my client has created a custom object for the entity we need to contact. I tried several methods in the UI and they have all ended up needing a User or Contact record to succeed. I'm now using APEX code in a trigger, it also requires a User, but I have managed to get past that using this work around: Sending Emails in Salesforce to Non-Contacts Using Apex
Now I need to pass my custom object into the Email Template to get the merge fields from it. I believe setWhatId is the correct approach, but it returns "Invalid entity type for whatId". Not sure where to turn now....
In short, I have a custom object that is not a user or a contact, but it does have a related custom object with an email address field (also not user or contact). I need to send an email to the email address recorded on the related custom object passing the custom object to the template to gain its merge fields.
Any help or guidance would be much appreciated. Can I even do this?
Best Regards, Rod