function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Veeru AVeeru A 

setTargetObjectID on Opportunity to Send Email to Contact Roles

I need to send messages to Opportunity Contact Roles based on changes to aTriggered Value. 

 

I have most of that working but it seems that setTargetObjectID is not  available for the Opportunity Object....only Leads, Contacts or Users.

 

I could build a map of Contacts and Opportunity ID's and use the contact as the setTargetObjectID

and use the Opportunity as the setWhatId ..... but I am thinking the Email will only get logged in Activity against the Contact as the main object and not the Opportunity. 

 

 

I suspect the only reason that the other objects can't use setTargetObjectID is that they do not have an "email" filed by default. Another frustrating Salesforce pothole.  Has anyone had success getting them to enable it for their org?

 

Are there any other approaches out there?

Veeru AVeeru A

Actually, just did a test and using whatID for the Opportunity did log correctly to the Opportunity. Next problem...no HTML Email Status related list on Opportunity....Oh Salesforce...why why why