+ Start a Discussion

Send email based on user

We have email templates set up for each of our support reps that send the contact a survey about their experience when a case is closed. To analyze the results we have one email/survey for each individual user.


How can I create code that sends the correct email template based on the Case Owner?


I know how to write code to send an e-mail automatically at the click of a button but I do not know how to write an if/then type of statement that would send the correct template based on user.


I know I can use workflow rule to do this but would prefer not to as we have a lot of support reps and I don't want to have dozens of workflow rules that slow down our Salesforce.

Best Answer chosen by Admin (Salesforce Developers) 
VoIP SolutionsVoIP Solutions

If the link to the survey is constant for each User, just add a custom field to the User object.


For example, I have a custom field for each User's customized dashboard and then I use the field in an email template to send a link to the new user with instructions.  Perhaps you could apply the same technique to your problem.  Then you would just have a single workflow rule and a single email notification.