Online Help | Desktop App

Building conditions

Updated in 2024

You build conditions using the Condition window.

To build a condition:

  1. Select the condition type in the navigation pane on the left side of the Condition dialog box. The following condition types are available:

    • Standard - This type allows you to check the state of a field or macro, or compare it with another field or value. A number of operators, such as equals and is not blank, are available. ClosedClick here to view examples.

      Response Date is not working hours of Maxwell Newcomb

      %[SYS Initiator ]% equals 'Mail Connector'

    • Compare Two Date Fields - This type allows you to compare two dates. ClosedClick here to view examples.

      Due Date is before Now by at least 1 hour (using default Work Calendar)

      Completed Date is after Due Date by at least 1 minute

    • SQL Criterion - This type provides a free-form text field where you can enter a SQL expression in the form of a SQL WHERE clause. The expression must return a TRUE or FALSE value. Use this condition type when you need to specify a complicated criterion that you can't do with the standard type. ClosedClick here to view examples.

      Select Purchase Orders that have at least one Purchase Order item

      Select technicians who have less than 10 Incidents assigned

  2. Create a condition of the chosen type:

    • ClosedTo create a "Standard" condition:

      1. Click the ellipsis button in the Field field and use the Select Placeholder window to select an object field or a macro whose value should be checked.

      2. Select the comparison operator from the Operator list. The type of field data determines the list of available operators.

      Some operators simply check the field's value (such as: is not blank, has been changed, is unique, is not working hours of technician, etc.), while others compare the chosen field's value to another value (such as: equals, is less than, is covered by calendar, is member of, etc.).

      1. If the operator compares the field’s value with another value:

        • To compare it with a fixed value, select Value in the Compare with list and enter the value in the Value field.

        • To compare it with another field's value or a macro, select Field in the Compare with list, click the ellipsis button in the Field field and use the Select Placeholder window to select the other field or macro. Both fields must be of the same data type.

    • ClosedTo create a "Compare Two Date Fields" condition:

      1. Click the ellipsis button in the Date 1 field and use the Select Placeholder window to select the first date (an object field, a macro, or a workflow parameter).

      2. Select the operator: is before or is after.

      3. Click the ellipsis button in the Date 2 field and use the Select Placeholder window to select the second date (an object field, a macro, or a workflow parameter).

      4. Specify the time difference between the first date and the second date to watch for:

        1. Choose one of the following:

          • by at most - non-strict comparison (X <= Y)
          • by at least - non-strict comparison (X >= Y)
          • by more than - strict comparison (X > Y)
          • by less than - strict comparison (X < Y)
          • by exactly - strict comparison (X = Y)
        2. Enter the number of time units or click the ellipsis button in the field and use the Select Placeholder window to select this number (an object field, a macro, or a workflow parameter). Then choose the time unit: Minute(s), Hour(s), Day(s), Week(s), etc. The time difference will be calculated and rounded up with the precision you choose here.

      5. Under Options, specify whether you want to compare the dates only within working hours or not:

        • To use the "round-the-clock (24/7)" calendar for comparing the dates, click Do not use any Work Calendar.

        • To compare the dates within working hours defined in the default work calendar, click Use the default Work Calendar.

        • To compare the dates within working hours defined in a non-default work calendar, click Use this Work Calendar and choose that calendar from the list. For details, see Work Calendars.

    • ClosedTo create an "SQL Criterion" condition:

      1. Type in a criterion name in the Name field.

      2. In the Text field, type in the SQL expression in the form of a SQL WHERE clause (without the word WHERE). The expression must return a TRUE or FALSE value.

      To build your SQL expression, click Build Expression and use the Build Expression window to enter your expression and insert placeholders for dynamic data.

      IMPORTANT: The SQL expression must refer to objects that exist in the database by the runtime of your Action or Trigger. You cannot refer to objects being created by a Create Object operation at runtime.

      For example:

        • An additional criteria on the Condition tab: Select Purchase Orders (POs) with at least one PO item:

          exists (select 1 from [PO_Items] where [PO_ID] = %[DBF ID ]%)
        • A condition in the "IF-<condition>-THEN" construct on the Programming tab: When assigning an Incident to a technician, check whether the specified technician already has 10 or more Incidents assigned:

          exists
          (select 1 from [Incident_List]
          	where [Status] not in ('Closed', 'Completed') AND
          	([Assignee_ID] = %[DBF Assignee_ID ]% OR
          	[Assignee_Group_ID] in (select [Group_ID] from [Group_Members] where [Person_ID] = %[DBF Assignee_ID ]%))
          having count(*) >= 10)
    • TIP: You can modify workflow parameters on the fly when configuring a workflow item or component or modifying Templates for Self Service Portal notifications. To open the Workflow Parameter window, right-click the selected placeholder and choose Placeholder Definition.

  3. Click OK.\

Handling empty and non-empty values in workflows

When creating workflows, comparing empty and non-empty values can lead to several issues if not handled correctly:

  • Using operators like does not equal without considering blank values can result in incomplete filtering. For example, a condition meant to exclude a specific status will not consider records where the status field is blank, leading to incomplete results.

  • Blank or null values might be unintentionally excluded when using operators that do not account for them. As a result, important records can be missed in the workflow.

  • Misunderstanding how operators handle empty values can lead to logic errors in workflows, causing unexpected behaviors or results.

To address these issues and improve clarity around comparing empty and non-empty values, a tooltip will appear when selecting the does not equal or does not contain/begin with/end with operators. The tooltip explains that these operators yield positive results only when the field value is not blank (not null).

To properly manage potential blank values and ensure that all relevant records are considered, it is recommended to use an additional condition with the is blank operator. To illustrate how it works, consider the following example.

Example of using the "is blank" operator

You need to filter records based on a status field. You want to include records where the status does not equal "Closed" and also handle cases where the status might be blank. You then create the following condition:

  • Field: Status
  • Operator: Does not equal
  • Value: "Closed"

The tooltip will inform you that this condition will not yield a positive result if the status field is blank. To address potential issues, add another condition using an OR logic:

  • Field: Status
  • Operator: Is blank

This will ensure that the workflow correctly includes records where the status is not "Closed" and accounts for any blank status values.