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
Roger RedfordRoger Redford 

My formula with CASE doesn't work, please help!!!

Hi everybody,

I am looking for a solution how to express a formula for an user-defined field with the following description:

the formula should show the corresponding letter salutation dependent on the picklist values in fields Salutation and tthe Contact Language, for example:

- if you choose in the picklist Salutation "Mr." and the Contact Language is "English", the user-defined field will show for example the expression "Dear Mr. John Benson" for John Benson, in the user-defined field

- if you choose in the picklist Salutation "Mrs." and the Contact Language is "English", the user-defined field will show for example the expression "Dear Mrs. Diana Fox" for Diana Fox

- if you choose in the picklist Salutation "Herr" and the Contact Language is "German", the user-defined field will show for example the expression "Sehr geehrter Herr X Y" for X Y

- if you choose in the picklist Salutation "Frau" and the Contact Language is "German", the user-defined field will show for example the expression "Sehr geehrte Frau A B" for A B


I wrote this formula, which unfortunately is not working right:

if((ISPICKVAL(Sprache__c  ,"Deutsch") && (ISPICKVAL(Salutation  ,"Herr"))),"Sehr geehrter Herr" & FirstName & LastName)
if((ISPICKVAL(Sprache__c  ,"Deutsch") && (ISPICKVAL(Salutation  ,"Frau"))),"Sehr geehrte Frau" & FirstName & LastName) OR
if((ISPICKVAL(Sprache__c  ,"Englisch") && (ISPICKVAL(Salutation  ,"Mr."))),"Dear Mr." & FirstName & LastName) OR
if((ISPICKVAL(Sprache__c  ,"Englisch") && (ISPICKVAL(Salutation  ,"Mrs."))),"Dear Mrs." & FirstName & LastName)

The syntax error says "extra if"

witth CASE:

CASE((ISPICKVAL(Sprache__c ,"Deutsch")) && (ISPICKVAL(Salutation ,"Herr")),"Sehr geehrter Herr" & FirstName & LastName,
((ISPICKVAL(Sprache__c ,"Deutsch")) && (ISPICKVAL(Salutation ,"Frau"))),"Sehr geehrte Frau" & FirstName & LastName,
((ISPICKVAL(Sprache__c ,"Englisch")) && (ISPICKVAL(Salutation ,"Herr"))),"Dear Mr." & FirstName & LastName,
((ISPICKVAL(Sprache__c ,"Englisch")) && (ISPICKVAL(Salutation ,"Frau"))),"Dear Mrs." & FirstName & LastName)

it says: "incorrect argument type for CASE"

Can anybody please help me? what am I doing wrong?
kevin lamkevin lam
Try this:

CASE(Sprache__c, "Deutsch", "Sehr geehrter", "English", "Dear", "") & " " & TEXT(Salutation) & " " & FirstName & " " & LastName
AgiAgi
Hi, try this
if((ISPICKVAL(Sprache__c  ,"Deutsch") && (ISPICKVAL(Salutation  ,"Herr"))),"Sehr geehrter Herr" & FirstName & LastName),
if((ISPICKVAL(Sprache__c  ,"Deutsch") && (ISPICKVAL(Salutation  ,"Frau"))),"Sehr geehrte Frau" & FirstName & LastName),
if((ISPICKVAL(Sprache__c  ,"Englisch") && (ISPICKVAL(Salutation  ,"Mr."))),"Dear Mr." & FirstName & LastName),
if((ISPICKVAL(Sprache__c  ,"Englisch") && (ISPICKVAL(Salutation  ,"Mrs."))),"Dear Mrs." & FirstName & LastName)))