+ Start a Discussion
Shantanu Punekar 5Shantanu Punekar 5 

Single email messaging: Target object id help

I have written a class to send an email to parent record owner and creater whenever a child record is created.
In this class we are using an email template (Merge fields) and we need to set target object id, if we set target object Id as a User we cannot set WhatId (throws error). As a work around we are creating a dummy contact with dummy email and using that Contact in target objectId. But in this situation we receive additional email stating email delivery failed to the dummy contact email.
Is there any solution to use User as a target object Id and WhatId so the email will be sent with template and merged fields ?

Thanks in advance.