Trick to Populate Email formula field in Email Alert in Salesforce

 As we know, formula field is not acceptable in Email Alert although the type is email . So there a hack to get away from it. I forgot where I read this info, credit to that developer.

We have run some unit test and so far it works. The drawback ; you may get error during deployment so you need to do it manually. So it may cost in maintenance section if you need to change email alert.

But if email alert is seldom change, it might be worth especially the email actually derived from the parent object. For example if the email field is at Account level but you need to create email alert at Opportunity.

It's quite costly if you need create field update to populate Opportunity with Account email field while actually you can just read using formula from Opportunity.

Here are the steps :

1) Create formula field at Opportunity ; data type is text (I forgot to check why I don't use email) 

2) In the email alert , at Recipient select one user 

3) Once select , right Click Inspect Element so you can see like below

4) Notice the value , put 18: <customfieldId> , I am not sure why I put 18 , you may want to try other number. Then click Save at the Email Alert.

5) Once save, it will reflect the field that you just created above


Popular Posts