[SalesForce] correct syntax for case function in formula field

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!

Best Answer

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.

Related Topic