Is there a way update the template in an email alert based on user input. I have a object called send email which has a pick list field with list of email template names. I am using a single email alert to send out emails using process builder.

I am looking for a way to update the template on the email alert based on what user select in the picklist value. If the user select template_01 in picklist field and click save - the template in email alert should be replaced with the name of the email template that user selected. Is this possible? or is there any workaround for this? Can we use apex to manipulate email alerts?

The purpose of doing this is when a customer wants to add a new email template , they just go into the system and create one. The email template is added to the picklist value. The user just selects the email template to be sent from the picklist value and that's it, rest is taking care by the system to send that particular template which user select. Customer does not want to create new email alert or add a new email alert in process builder.

1 Answer 1


You can't directly use Process Builder for this, as the template must be selected in the Process Builder itself (as a static value). However, you could invoke some Apex Code or a Flow to send the emails. As always, if the templates are being sent to users, you'll be able to send as many as you want daily, but there's a limit on the number of emails you can send to external emails, contacts, and leads using these options.

  • I use only one email alert in process builder. All I have is 5 email template. Can i choose which template to be sent out and update the template field in email alert accordingly?
    – SfdcBat
    Oct 17, 2016 at 22:20
  • @SfdcBat No, you'd have to hard-code each possible value into the process builder, so if the customer added a new template, they'd also have to update the process builder to match. You'll need to use either Flows or Apex Code.
    – sfdcfox
    Oct 17, 2016 at 22:23
  • How can this be done using apex code? Can you throw some insights? If there is a new template added then do I need to make appropriate changes in the code to accommodate the new email template? Basically I do not want my customer to touch the apex code or process builder in future.
    – SfdcBat
    Oct 17, 2016 at 22:30
  • @SfdcBat I didn't realize I missed this comment, but you could use a Custom Setting to allow the customer to input the name or ID of the template, then have your Apex Code query for the template and specify it using setTemplateId. It shouldn't be pretty hard to figure out.
    – sfdcfox
    Oct 23, 2016 at 0:27
  • that's fine , my client did not want to go with Apex code development at this point. But thanks for the input.
    – SfdcBat
    Oct 23, 2016 at 0:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .