The Official Salesforce Blog

The Official Salesforce Blog

Using checkbox fields in formulas

Eric Bezar Aug 20, 2005

CheckboxThere are some important checkbox fields in salesforce.com that you may find useful to reference in formulas.  "Do not call" and "Email opt out" on the Contacts tab are but a couple examples.

Is this possible, you ask?  Yes, but there's a trick to it: checkbox fields are treated as Booleans with a value of TRUE for checked and FALSE for unchecked.

 

You can use a checkbox field directly in an IF function as follows:

IF ({!HasOptedOutOfEmail} , "checkbox is checked", "checkbox is unchecked" )

Note that if you compare a checkbox field to the literal TRUE or FALSE in an IF statement, you will get the following syntax error.

IF ({!HasOptedOutOfEmail} = TRUE , "checkbox is checked", "checkbox is unchecked" )
Error: Incorrect argument type for function =.

 

0 Comments

Post a comment