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
StefanStefan 

Emailing in foreign languages

I have added a language list box to the contact page: English, Italian, French
 
I have added a formula field and want to populate this:
 
If Saluation = Mr. and Language = Italian
           Egregio Dottor LastName
 
If Saluation = Mrs. and Language = Italian
           Gentile Dottoressa Last Name
 
If Saluation = Mr. and Language = English
            Dear Mr. LastName
 
If Saluation = Mrs. and Language = English
            Dear Mrs. LastName
 
How do I write a formula to handle this, I am running into error messages because these fields are pick lists
 
 
 
NPMNPM

Look at the ISPICKVAL function to do this. This is not tested but would look something like this - not sure I have the " and () correct.

 

OR(

AND(ISPICKVAL(salutation, Mr.), ISPICKVAL(language, Italian), "Egregio Dottor" & " " &LastName),

AND(ISPICKVAL(salutation, Mrs.), ISPICKVAL(language, Italian), "Gentile Dottoressa" & " " &LastName),

AND(ISPICKVAL(salutation, Mr.), ISPICKVAL(language, English), "Mr." & " " &LastName),

AND(ISPICKVAL(salutation, Mrs.), ISPICKVAL(language, English), "Mrs." & " " &LastName)

)


 

NPMNPM
The Mr., Mrs., Italian, English should be surrounded with "" in the formula - something I missed.
StefanStefan
Thanks for the suggestion which I amended as below but getting error:
 
Error: Incorrect parameter for function AND(). Expected Boolean, received Text
 
OR(
AND(ISPICKVAL(salutation, "Mr."), ISPICKVAL( Language__c , "Italian"), "Egregio Dottor" & " " &LastName),
AND(ISPICKVAL(salutation, "Mrs."), ISPICKVAL(Language__c , "Italian"), "Gentile Dottoressa" & " " &LastName),
AND(ISPICKVAL(salutation, "Mr."), ISPICKVAL(Language__c , "English"), "Mr." & " " &LastName),
AND(ISPICKVAL(salutation, "Mrs."), ISPICKVAL(Language__c , "English"), "Mrs." & " " &LastName)
)
StefanStefan
Hi, came up with the following code :
 
Code:
CASE( Language__c , 
             "English", 
                             CASE( Salutation , 
                                               "Mr.", "Dear Mr. " &  LastName  , 
                                                "Ms.", "Dear Ms. " &  LastName  ,
                                                "Mrs.", "Dear Mrs. " &  LastName  ,
                                                "Dr.", "Dear Dr. " &  LastName  ,
                                                "Prof.", "Dear Prof. " &  LastName ,
                                                "Dear Mr or Ms. " &  LastName) ,
              "Italian", 
                             CASE( Salutation , 
                                               "Mr.", "Egregio Dottor " &  LastName  , 
                                                "Ms.", "Gentile Dottoressa " &  LastName  ,
                                                "Mrs.", "Gentile Dottoressa " &  LastName  ,
                                                "Dr.", "Egregio Dottor " &  LastName  ,
                                                "Prof.", "Egregio Dottor " &  LastName ,
                                                "Egregio Dottor " &  LastName) ,
             CASE( Salutation , 
                                               "Mr.", "Dear Mr. " &  LastName  , 
                                                "Ms.", "Dear Ms. " &  LastName  ,
                                                "Mrs.", "Dear Mrs. " &  LastName  ,
                                                "Dr.", "Dear Dr. " &  LastName  ,
                                                "Prof.", "Dear Prof. " &  LastName ,
                                                "Dear Mr or Ms. " &  LastName)  )

 
NPMNPM
Mine was wrong headed, I was focused on ISPICKVAL and was thinking of the formula being used in a different way than you intended. The CASE you came up with is great.