[SalesForce] write if/else condition for mail merge template

Does anyone have an example of an If statement in a microsoft word mail merge template? I would like to use salutation on some of my labels but not all records have data so salesforce replaces it with eight underscores (no clue why). I'd like to replace those underscores with an if statement but Im having trouble figuring out the syntax.

Best Answer

Fourq,

Historically, we have solved this in one of two ways:

  1. Replace your word templates with VisualForce Templates, in which case JimRae's comment is applicable.
  2. Creative and judicious use of Formula fields. Using this method, you'll be merging in your formula field, not the actual contact_salutation field. Essentially, your Formula field, say fContactSalutation__c uses

    IF(isEmpty(contact_salutation), 'replacement text', contact_salutation)

Related Topic