Hi Everyone...
I have the current script below but Id' like to add 'Madame' and 'Monsieur' as values instead of just 'Mr.' and 'Mrs.' :
#set ($greetCheck = ${lead.Salutation})
#if ($greetCheck.contains('Mr.'))
Cher ${lead.FirstName},
#elseif ($greetCheck.contains('Mrs.'))
Chère ${lead.FirstName},
#else
Bonjour,
#end
So to summarise, I want to use Cher + first name to people whose title is either Mr. or Monsieur in the database.
Many thanks !
Probably not the most elegant solution ever, but this works:
#if ($greetCheck.contains('Mr.') or $greetCheck.contains('Monsieur'))
Cher ${lead.FirstName},
Seek a collection-centric approach to make this easier to manage as more options are added:
#set( $greetingsBySalutation = {
["Mr.","Monsieur"] : "Cher ${lead.FirstName},",
["Mrs."] : "Chère ${lead.FirstName},",
[] : "Bonjour,"
} )
#foreach( $option in $greetingsBySalutation.keySet() )
#if( $option.contains($lead.Salutation) || $option.isEmpty() )
#set( $greeting = $greetingsBySalutation[$option] )
#break
#end
#end
${greeting}
Also, please highlight code when posting to the Nation so it's readable: