3

Simple question, we have 50+ email templates that are currently not activated that need to be. I was curious is there a way to do this in bulk or through metadata rather then editing each one individually and spending an hour?

enter image description here

4

You should be able to do it with an Apex call, from Workbench it looks like the field IsActive on EmailTemplate is writable:

enter image description here

So this can be done within the metadata with a package. For example, here is an email template meta.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<EmailTemplate xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>32.0</apiVersion>
    <available>TRUE</available>   <----- EDIT THIS LINE
    <description>Your email template description</description>
    <encodingKey>ISO-8859-1</encodingKey>
    <name>Email Template Name</name>
    <style>none</style>
    <subject>Subject Line of email template</subject>
    <type>visualforce</type>
</EmailTemplate>

So once you've edited the files needed simply package and deploy the changes.

Bonus Points:

If you're using an IDE like Sublime Text that lets you search and replace your entire code base you can do this with one click.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.