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
HoltzyHoltzy 

Populate custom Email field with a User's email address

I have an existing field on the Account object that is a lookup to the User table.  I want to create a new custom Email field that will display the email address of the User shown in the existing lookup field.  Can this be done without creating an Apex trigger?

 

My ultimate goal is to create a Workflow Rule/Email Update that will send an email to the User shown in the existing field on the Account object.  The only way to do this without writing an Apex trigger is to have an Email field that the email alert can reference.

 

Any suggestions/guidance would be greatly appreciated.

 

Best Answer chosen by Admin (Salesforce Developers) 
Satish_SFDCSatish_SFDC

You will have to use a workflow field update to update the custom email address field.
Once done, you can then send email alerts based on your criteria to the email mentioned in the custom email field.

 

However, there are some points to be considered.

1. If you create two or more workflow, the order in which the workflows are processed is not guaranteed.

2. In a single workflow, if there are multiple actions, there is no guarantee on the order in which the invidual actions are performed. But Field updates are always executed first.

 

Just for the test scenario, lets assume you want to send an email on the some criteria ( say Annual Revenue greater than 1000) 

1. Create a workflow rule: Evaluation Criteria: When record is created or edited.   Rule Criteria: Annual Revenue greater than 1000.

2. Create a new field update action for the workflow you just created. Update the custom email field you created with the Email of the User (in the Lookup).

3. Create another Email Alert action for the same workflow and for the recipient, select the custom email field.

4. Activate workflow

 

This should solve your requirements. The fact that Field updates are always executed first ensures that whenever the record meets the criteria (Revenue more than 1000 in our eg), it gets the latest email address of the user and then sends the email.

 

Let me know if you have any questions.

 


Regards,
Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.