+ Start a Discussion
Ricki ReayRicki Reay 

HELP: Auto-populating "To" field on Email action form to comply with Email Tracking?

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.

Thanks,

Ricki
Best Answer chosen by Ricki Reay
AbhishekAbhishek (Salesforce Developers) 
Hi Ricki,

Try the suggestions as mentioned in the below blog,

https://success.salesforce.com/answers?id=9063A000000e9ogQAA

I hope it will help you.
 

All Answers

AbhishekAbhishek (Salesforce Developers) 
Hi Ricki,

Try the suggestions as mentioned in the below blog,

https://success.salesforce.com/answers?id=9063A000000e9ogQAA

I hope it will help you.
 
This was selected as the best answer
Ricki ReayRicki Reay
Hi Abhisek,

Thank you so much for sharing that link. I got it working using the JUNCTIONIDLIST function and "To Recipients" field, instead of the "To" field.

Thanks again - I very much appreciate it!

Ricki