Insert-if sections: Add, change, and remove conditions

In Shared Email Templates for Microsoft Outlook

You can add a condition to a paragraph, a list, a list item, a table, or a table row and get this section inserted into an email message along with the whole template only when the condition is met. A section that you've added a condition to becomes an Insert-if section.

To get a quick Insert-if Sections cheat sheet, click the button below.

Download cheat sheet

How to add conditions to different parts of a template

How to add conditions to different parts of a template

In this video, we explain step by step how to automatically insert part of your template into a message only if a specific condition is met.

Run time: 03:53

How to add a condition

You can base your condition on some text in an email message field or on the result returned by the WhatToEnter macro.

Adding a condition based on text in a message field

  1. Start creating or editing your template, right-click a section that you want to add a condition to (a paragraph, a list, a list item, a table, or a table row), and then select Add Condition.
    The Add Condition option

    Note. If you select several paragraphs or list items, right-click, and then select Add Condition, your condition will be added to each of the selected paragraphs or list items separately. So, if you decide to change the added condition later on, you'll have to change it for each of the paragraphs or list items individually.

  2. The Add condition dialog will appear. Under Find in, select Message field.

    • Choose a field that will be checked for your condition: body, from, to, cc, bcc, subject, location, recipient's or sender's first, last, or full name.
    • Select the condition itself: "contains", "doesn't contain", "is equal to", "matches", or "doesn't match".
    • Enter the text or regular expression that the add-in will look for when checking whether your condition is met.

      Note. Such conditions as "matches" and "doesn't match" require a regular expression.

    Click OK.
    The Add condition dialog

    Note. You can select the Case-sensitive checkbox for such conditions as "contains", "doesn't contain", and "is equal to".

    The Case-sensitive checkbox

  3. The section that your condition is applied to will be marked with a green indicator. Save your template.
    A green indicator in a template

    Note. If you add a condition to a list item, you won't be able to add a condition to the whole list, and vice versa. If you add a condition to a table row, you won't be able to add a condition to the whole table, and vice versa.

    Note. If you copy a paragraph from another source and paste it into your template, <p> tags might be missing there, and it won't be possible to add a condition to such a paragraph.

Adding a condition based on the WhatToEnter macro result

  1. In a template you're creating or editing, right-click a section where a condition is needed: a paragraph, a list, a list item, a table, or a table row. Then select Add Condition.
    The Add Condition option

    Note. If you select several paragraphs or list items, right-click, and then select Add Condition, your condition will be added to each of the selected paragraphs or list items separately. So, if you decide to change the added condition later on, you'll have to change it for each of the paragraphs or list items individually.

  2. In the Add condition dialog (under Find in), select WhatToEnter result.

    • Choose a WhatToEnter macro that will be checked for your condition. There must be at least one WhatToEnter macro with the Text field, Dropdown list, or Dataset option in your template. The Date and Time options of the WhatToEnter macro are not supported.
    • Select the condition itself: "contains", "doesn't contain", "is equal to", "matches", or "doesn't match".
    • Enter the text or regular expression that the add-in will look for when checking whether your condition is met.

      Note. Such conditions as "matches" and "doesn't match" require a regular expression.

    When you're done, click OK.
    The Add condition dialog

    Note. You can select the Case-sensitive checkbox for such conditions as "contains", "doesn't contain", and "is equal to".

    The Case-sensitive checkbox

    Tip. To avoid inserting the result returned by the WhatToEnter macro into an email message along with the whole template and use that result to simply check your condition, select the For Insert-if sections only checkbox when inserting the WhatToEnter macro into your template.
    The For Insert-if sections only checkbox

  3. A green indicator shows the section that your condition is applied to. Click Save.
    A green indicator in a template

    Note. If you add a condition to a list item, you won't be able to add a condition to the whole list, and vice versa. If you add a condition to a table row, you won't be able to add a condition to the whole table, and vice versa.

    Note. If you copy a paragraph from another source and paste it into your template, <p> tags might be missing there, and it won't be possible to add a condition to such a paragraph.

How to change a condition

If you want to modify a condition, right-click the section it's applied to and opt for Change Condition.
The Change Condition option

After you make the necessary changes, click Save.

How to remove a condition

Right-click a section where the condition is not needed. Then select the Remove Condition option.
The Remove Condition option

After removing the condition, click Save.

Post a comment

Seen by everyone, do not publish license keys and sensitive personal info!

If you have any questions or issues with this add-in, please feel free to post your concerns in the comments area. As soon as we answer, a notification message will be sent to your e-mail. If you do not want to share your thoughts in public, please contact us at support@ablebits.com.