[SalesForce] Custom Send Email Button With A “Hidden” Email Template

Anyone have an idea on how to have an Email Template in Salesforce which most Users "cannot see" but which they can use to send to clients? This would be done via a simple Custom Button:


The problem becomes that in the windows produced by this, they can simply click "Select Template" and it defaults to the Folder the template came from. I can't simply remove the Select Template button since that's needed for "all other" emails.


I decided to try something illogical (to me) and it worked(?!). I created a Test email template folder which was set to "This folder is hidden from all users". I put a copy of the template there. I pointed my custom button at that copy of the template.

Not only did it allow the email template to be used by an average user, but when they click "Select Template", it does NOT show them that folder (as would be expected).

Does anyone know of any side effects I would be inheriting by doing this? This seems to be the exact solution I need – it just didn't make sense until I actually tried it (that you can use a template, if you know it's SFID, regardless of what folder it is in/permissions on that folder).

Best Answer

  1. If you have power users that are determined enough they might still be able to navigate to the template by shortening the URL from




    (no idea if it'd give them "insufficient privileges").

  2. The behaviour described in your "Update 1" sounds to me like some kind of security flaw that SF might decide to fix in future. I'm not sure I'd count on something like this in a production-ready functionality. Maybe simply raise a Case with support whether it's intended behaviour?

  3. If it's acceptable to just fire the email as is (without user being able to preview & modify the body) maybe you can experiment with adding &save=1 to the URL. Still - a determined user might inspect the source of the button and learn the template id.

  4. You could also consider a "do it yourself" solution with a bit of Apex? Both single and mass email objects have setTemplateid() method you could use. You can query the EmailTemplate object for IDs.

Related Topic