• Samy Cools
  • 0 Points
  • Member since 2022

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1
Hi all,

I am trying to create a custom action on the Opportunity object which populates the "To" field (API: ToAddress) on the email form like it does on the Lead and Contact/Person Account records. I want the field to auto-populate with the Person Account if the opportunity is linked to a Person Account (i.e. IsPerson = TRUE) and auto-populate with a custom field Company_Email__c if the opportunity is linked to a Business Account (i.e. IsPerson = FALSE). 

In order to have email tracking working, one of the requirements is that the To field links to a Contact, Person Account or Lead in Salesforce. So I can't just pre-populate the field with the email address on the Person Account - as this would not be linked as per Salesforce's email tracking requirements. I need this field to pre-populate so that it links to the actual record in SF. I have tried pre-populating with ID for this field, but have had no luck. Here is the formula I was attempting to use for this "To" lookup field:

if( Opportunity.Account.IsPersonAccount = TRUE,  Opportunity.Account.PersonContactID, Opportunity.Account.Company_Email__c)

And this is the result: 
User-added image
Whereas, I want it to do this:
User-added image

Appreciate any and all help on this.