This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Wannan tattunawa ta zama daɗaɗɗiya. Yi sabuwar tambaya idan ka na bukatar taimako.

Mail Merge conditional on field ending with a period produces wrong result

more options

I am trying to make the salutation in my email conditional on whether the recipient has a Job Title or not, but it isn't working properly. The email is sent, but the salutation is always "Dear {{First Name}},", even though the {{Job Title}} later prints as 'Dr.', which ends with a period. I need to test for the period character as I have other titles that follow the same rule.

It appears that the If/Then/Else isn't working properly. Would anyone know what I'm doing wrong?


In the body of my mail, I have the following, which always ends up printing "Dear {{First Name}},":

   Dear {{{{Job Title}}|$|.|{{Job Title}} {{Last Name}}|{{First Name}}}},
   
   Print
   {{Job Title}}
   {{Last Name}}
   {{First Name}}
   End

When I change the code to the following, the Job Title prints as expected:

   Dear {{{{Job Title}}|$|.|{{Job Title}}}},
   
   Print
   {{Job Title}}
   {{Last Name}}
   {{First Name}}
   End


In my CSV file, I have the following:

   First Name,Last Name,Display Name,Nickname,Primary Email,Secondary Email,Screen Name,Work Phone,Home Phone,Fax Number,Pager Number,Mobile Number,Home Address,Home Address 2,Home City,Home State,Home ZipCode,Home Country,Work Address,Work Address 2,Work City,Work State,Work ZipCode,Work Country,Job Title,Department,Organization,Web Page 1,Web Page 2,Birth Year,Birth Month,Birth Day,Custom 1,Custom 2,Custom 3,Custom 4,Notes
   MyFirstName,MyLastName,MyFirstName MyLastName,,me@myemail.com,,,,,,,,,,,,,,,,,,,,Dr.,,,,,,,,,,,,
I am trying to make the salutation in my email conditional on whether the recipient has a Job Title or not, but it isn't working properly. The email is sent, but the salutation is always "Dear {{First Name}},", even though the {{Job Title}} later prints as 'Dr.', which ends with a period. I need to test for the period character as I have other titles that follow the same rule. It appears that the If/Then/Else isn't working properly. Would anyone know what I'm doing wrong? In the body of my mail, I have the following, which always ends up printing "Dear {{First Name}},": Dear {{{{Job Title}}|$|.|{{Job Title}} {{Last Name}}|{{First Name}}}}, Print {{Job Title}} {{Last Name}} {{First Name}} End When I change the code to the following, the Job Title prints as expected: Dear {{{{Job Title}}|$|.|{{Job Title}}}}, Print {{Job Title}} {{Last Name}} {{First Name}} End In my CSV file, I have the following: First Name,Last Name,Display Name,Nickname,Primary Email,Secondary Email,Screen Name,Work Phone,Home Phone,Fax Number,Pager Number,Mobile Number,Home Address,Home Address 2,Home City,Home State,Home ZipCode,Home Country,Work Address,Work Address 2,Work City,Work State,Work ZipCode,Work Country,Job Title,Department,Organization,Web Page 1,Web Page 2,Birth Year,Birth Month,Birth Day,Custom 1,Custom 2,Custom 3,Custom 4,Notes MyFirstName,MyLastName,MyFirstName MyLastName,,me@myemail.com,,,,,,,,,,,,,,,,,,,,Dr.,,,,,,,,,,,,

An gyara daga Nap_BlownApart

Mafitar da aka zaɓa

Alexander, the developer of the Mail Merge addon, contacted me about this problem and explained what I had done wrong. Here is a summary, in my words, that should assist others with the same problem.

You have a syntax issue based on a misunderstanding of the documentation.

The conditional syntax is actually an extension of how variables are represented, rather than a separate construct. Therefore, the statement should be:

Dear {{Job Title|$|.|{{Job Title}} {{Last Name}}|{{First Name}}}},

Notice the lack of curly brackets around the first `Job Title`.

Karanta wannan amsa a matsayinta 👍 0

All Replies (1)

more options

Zaɓi Mafita

Alexander, the developer of the Mail Merge addon, contacted me about this problem and explained what I had done wrong. Here is a summary, in my words, that should assist others with the same problem.

You have a syntax issue based on a misunderstanding of the documentation.

The conditional syntax is actually an extension of how variables are represented, rather than a separate construct. Therefore, the statement should be:

Dear {{Job Title|$|.|{{Job Title}} {{Last Name}}|{{First Name}}}},

Notice the lack of curly brackets around the first `Job Title`.