0

i'm new to the CASE function and so i just want to make sure my syntax is correct.

i am trying to accomplish:

  • If source_system__c ="Adobe" AND
    • If Bounce_Type_Code__c="0" then "Not Defined"
    • If Bounce_Type_Code__c="1" then "Soft Bounce"
    • If Bounce_Type_Code__c="2" then "Hard Bounce"
    • If Bounce_Type_Code__c="3" then "Ignored"

and what i've come up with is:

CASE(Source_System__c,
'Adobe',
    CASE(Bounce_Type_Code__c, 
        '0', 'Not Defined',
        '1', 'Soft Bounce',
        '2', 'Hard Bounce',
        '3', 'Ignored', 
        null
    ), null
)

is this correct? thanks!

3
  • Looks fine. You could replace your first CASE with an IF but both will give you the same result.
    – TSmith
    Commented Jun 16, 2020 at 13:34
  • @TSmith i'm just worried that by doing that i'd mess up the syntax
    – nueve
    Commented Jun 16, 2020 at 13:40
  • Probably the quickest way to check formula syntax is the "check syntax" button that appears in the UI under the area where you enter the formula. It's faster than asking a question here (if the syntax is fine). Just something to keep in mind for the future.
    – Derek F
    Commented Jun 16, 2020 at 15:39

1 Answer 1

1

Generally speaking, this is correct, but be mindful of your data types. If Bounce_Type_Code__c is a numeric field, you would not enclose the match values in quotes (e.g. 3 instead of '3'). Other than that, it looks just fine.

You must log in to answer this question.

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