Creating Criterias

This document will give a basic overview of criterias.

See this article about Criteria Syntax for more detailed information about the whole overview of criteria syntax.

Determine the Target Type

Most places where Criteria are used require selection of a Target Type beforehand - please make sure you know which Target Type the criteria is for.

For example, the Target Type field on a Tag Criteria:

Using Criteria

  1. Field names are case insensitive and will match the names of the columns in the list view of the target type. Remove the space in the column before using the field.
  2. The Operator determines what kind of comparison takes place - here we're looking for equality. See the Operators section of the linked article for more information on all of the available comparisons.
  3. This is a Literal String - these must be contained within single quotes.

The whole criteria searches for a Contact where the First Name is John. Comparisons are Case Insensitive, so "john", "John" and "JOHN" will all be returned for this criteria.

Builtin Functions

If we weren't just looking for John, but also for Johnny and Johnathan, we can change this criteria slightly to use one of the inbuilt Function Operators.

  1. The function we use is StartsWith. the General format for a function is its name, followed by an opening bracket. Inside the bracket there is a comma separated list of items that the function uses, then a closing bracket.
  2. The FirstName field
  3. Literal string 'John'

Now we will get all contacts whose first name starts with John.

Chaining conditions

If we also wanted to see contacts where the first name is Alice, we can combine the two conditions into a single criteria. There are two options for logical operators - Or, And.

  1. This is the Criteria from above.
  2. This is the logical operator "Or" - if either one of what is on it's left is true or what is on it's right is true, the whole criteria resolves to true. In this way we can get both John contacts and Alice contacts.
  3. This is a modified version of the first criteria above.

However you do have to be careful with using these - a misplaced logical operator can lead to your criteria giving more (or less) results than you expected.

The And operator is similar to the Or operator except that the criteria on both sides of the operator but be true for the whole criteria to resolve to true.

Example Criterias

Below are several examples for more complicated criteria - feel free to modify these for use in your own criterias.

Job Pending Sign-Off

This criteria is used to alert users and clients that a Job is Pending sign-Off, and if they can review the work that has been done and sign off on the job. The Target Type here is a Job.

 [Status.Name] = 'Pending Sign-Off' and [CreateDate] > #2018-02-13#

The criteria just checks if the Job's Status Name is Pending Sign-Off, and also checks that the Create Date is after a certain date. (We add the Create Date condition in to workflow criterias when there are previously created items for the Target Type, since just having the criteria of the Name will look through all Jobs in the database, regardless of when they are from.)

Tagging Accountancy Package Customers

This criteria is used to automatically tag Contacts and Companies as having come from Xero - the same criteria can be applied to Reckon, MYOB and in several other places that are contained within the CRM.

 [XeroContact.IsCustomer]

It just checks whether or not the Contact's Xero Customer link is marked as a Customer.

Retrieving a Task List in a Client Page

This criteria is used to ensure that the Task List client page only shows tasks that the current user is assigned to.

 [AssignedUsers][User = CurrentUserId()] And Status !=  'Completed'

It checks the Task's Assigned Users list, looking for a User with the same ID as the current user, and also makes sure the task is not already completed.

The first part of this criteria, [AssignedUsers][User = CurrentUserId()], means "The Assigned Users collection, filtered to where the User has the same ID as the current user's ID". By default this resolves to True if the filtered collection contains at least one record.

The criteria also makes sure the Task has not yet been completed.

Sending Emails to Users

We used this criteria in a Scheduled Workflow to email certain users on certain days. The target type here is CreataUser.

 [DisplayName] in ('User 1', 'User 2', 'User 3', 'User 4') AND [UserName] <> 'John Smith' AND iif(StartsWith([DisplayName], 'John'), GetDayOfWeek(Now()) = 4, GetDayOfWeek(Now()) = 5)

The criteria selects certain users based on their DisplayName, excludes a user based on their UserName, and then checks the DisplayName - if the Display Name meets the criteria we check if the Day of Week is 4 (Thursday), otherwise we check if it is 5 (Friday).

results matching ""

    No results matching ""