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
Nathan S.ax891Nathan S.ax891 

Checkbox values in Email Templates

Hi Everyone,

 

What we are trying to achieve is to have a checkbox return a value other than "0" and "1", whether it be the field name, or a custom string of text, either would work. Does anyone know if this is possible? As far as I know, operators cannot be used in email templates?

 

Thanks for any advice

jhurstjhurst

There are a couple of option:

 

1. You can fceate a formula field on your Object that is the value you want to display.  You can then include that field in your email template.  For instance, I used:

 

IF(Checkbox__c==True, "The Checkbox is checked", "The Checkbox is not checked")

 

2. You can create a Visualforce Email Template and include the checkbox.  The field should be listed as "true" or "false"

 

Hope this helps.

 

Jay

Nathan S.ax891Nathan S.ax891

Hi Jay,

 

Thanks for the advice, it worked out quite well :)

 

-Nathan

SatoriSatori

We are facing the same issue, but the business actually wants to see the checkmark shown in the template when the value is true, is this possible?

 

If so, how would one accomplish this?

 

 

WallaroWallaro

I am trying to write a formula on my object like you described. Here is my formula:

IF ( Spanish_Speaker__c == true, "Spanish Speaker", "English Speaker" )

However when I check the Syntax I receive this error:

Error: Formula result is data type (Text), incompatible with expected data type (true or false).

Correct me if I am wrong, but I thought the point of this formula was to output text and not a boolean number. Can anyone see what I am doing wrong?

Amack DawgAmack Dawg
@jhurst is there a way to fairly easily 'map' a checkbox value ('0' or '1' in this case) to a servelet png image?

For example, a checkbox value of '1' would map to a custom image, and '0' would map to another one.
Amack DawgAmack Dawg
@Nathan S.ax891 not sure if you figured this out yet, but a simple hack could be just creating a VisualForce page (instead of HTML) and then wrapping the Checkbox merge field in the <apex:outputField value="{!yourObject.yourField}" /> tags.

Just tried this today and it works! Although you will likely need to whitelist your Salesforce servlet ([yourSfdcDomain].force.content.com) or gmail will break the images.

Not sure how to guarantee functionality for external facing emails
Elliot LarardElliot Larard
For anyone still looking for the workaround with Classic Email Templates, you can just wrap the checkbox field in an IF statement within the HTML and text versions of the template.
  • Checkbox Field: {!IF(ObjectName.Checkbox_Field__c, 'Yes', 'No')}
The trick is not to use "==True" or you will get no output. No need for extra formula fields on the object though if you just want the information in an email.
Elizabeth LesterElizabeth Lester
Bless you @Elliot Larard!
Dan SuderDan Suder
Regarding Elliot Larard's answer...I always receive "no" even if the checkbox produces a "1" (yes) response.  Has anyone experienced this and found a solution?
Tejaswini LambeTejaswini Lambe
Its not working for me. I always get blank result.