You can learn more about sending email, using templates, and using expressions with workflow in the Workflow: Sending Email section.

You can use <<If>> expressions to conditionally include or exclude portions of a workflow template. You can use <<If>> expressions in:

  1. Google Docs templates
  2. Word Doc templates
  3. Email Subject, Body, and PreHeader templates.
  4. Notify Title and Body templates
  5. SMS Body templates
  6. Webhook Body templates

Each <<If>> expression begins with <<If: yesno-expression>> and ends with <<EndIf>>. If the yesno-expression yields evaluates as TRUE, the template content between <<If>> and <<EndIf>> tags is included; otherwise, it is excluded.

If Expressions Can Conditionally Display a Field

You can use an <<If>> expression to conditionally display a column value. For example, you can display the Address column value if the person is at least 21 years old; otherwise, the Address column value is omitted:

<<If: ([Age] >= 21)>>
Address: <<[Address]>>
<<EndIf>>

Or, all in a single line:

<<If: ([Age] >= 21)>>Address: <<[Address]>><<EndIf>>

If Expressions Can Conditionally Format a Field

You can use an <<If>> expression to conditionally format a field. For example, you can display a column's value as normal text its value is small, or in bold text if its value is large: 

<<If: ([Amt] < 100)>>
Amount: <<[Amt]>>
<<EndIf>>
<<If: ([Amt] >= 100)>>
Amount: <<[Amt]>>
<<EndIf>>


As another example, you can display a field value in red text if it is a negative value or in green text if it is positive:

<<If: ([Amt] < 0)>>
Amount: <<[Amt]>>
<<EndIf>>
<<If: ([Amt] >= 0)>>
Amount: <<[Amt]>>
<<EndIf>>

If Expressions Can Display an Updated Field

You can use an <<If>> expression to display a field when its value has changed. For example:

<<If: ([_THISROW_BEFORE].[Address] <> [_THISROW_AFTER].[Address])>>
Old Address: <<[_THISROW_BEFORE].[Address]>>
New Address: <<[_THISROW_AFTER].[Address]>>
<<EndIf>>

If Expressions Can Be Nested

Am <<If>> expression can occur within another (i.e., cane be nested) to arbitrary depth. For example:

<<If: ([Age] >= 21)>>
<<If: ([Gender] = "Male")>>
<<If: ISNOTBLANK([Address])>>
Address: <<[Address]>>
<<EndIf>>
<<EndIf>>
<<EndIf>>

Or, more concisely:

<<If: AND(([Age] >= 21), ([Gender] = "Male"), ISNOTBLANK([Address]))>>
Address: <<[Address]>>
<<EndIf>>

If Expressions Can Contain Start Expressions

<<If>> expressions can contain <<Start>> expressions. For example:

<<If: COUNT([Related OrderDetails])>0>>

Order Detail Records

<<Start: [Related OrderDetails]>>

Product: <<[Product]>>
Qty: <<[Qty]>>
Amount: <<[Amount]>>

<<End>>

<<EndIf>>

Start Expressions Can Contain If Expressions

<<Start>> expressions can contain <<If>> expressions. For example:

Order Detail Records

<<Start: [Related OrderDetails]>>

Product: <<[Product]>>
<<If: ([Qty] > 1)>>Qty: <<[Qty]>><<EndIf>>
Amount: <<[Amount]>>
<<End>>

If Expressions Can Contain Images

<<If>> expressions can contain images. This allows you to include or exclude an image based on the value of the <<If>> expression. For example:

<<If: ISNOTBLANK([Image])>>
Image: <<[Image]>>
<<Endif>>

If Expressions Can Contain Web Images

<<If>> expressions can contain web images. This allows you to include or exclude an image obtained from the web based on the value of the <<If>> expression.

For example, when using a Google Doc template, you can conditionally include a web image as follows:

  1. Open the template in Google Docs.
  2. From the Insert menu, select Image, then choose an image. For example, you could select By URL to enter a URL. You might enter:
    http://cdn0.iconfinder.com/data/icons/harmonicons-02/64/check-box-512.png
  3. Click the inserted image and resize as desired.
  4. Insert an <<If>> before the image:
    <<If: ([Answer] = TRUE)>>
  5. Insert an <<Endif>> after the image. For example:
    <<Endif>>

This will include a marked checkbox image if the Answer column value is TRUE. You can include an unmarked checkbox image if the Answer column value is FALSE as follows:

  1. Repeat the first three steps above, but enter this URL:
    http://chittagongit.com//images/square-icon/square-icon-13.jpg
  2. Insert an <<If>> before the image. For example:
    <<If: ([Answer] = FALSE)>>
  3. Insert an <<Endif>> after the image. For example:
    <<Endif>>

If Expressions Can be Contained in Table Cells

<<If>> expressions can be contained in table cells. This allows you to include or exclude content within the cell. 

This example displays the person's Age if they are an adult and Minor otherwise.

This example displays the Count in bold italics if it negative and in normal text otherwise.

Did this answer your question?