SalesForce.com Confluence Query Conditions

This guide details the <condition> clauses in the various reporters for the Salesforce.com Confluence add-on.

The Condition Structure

This is basically broken up into 3 parts:

  • Field - this is basically a single attribute for an object in Salesforce.com, for example, the "Case" object has the "Fields": Id, CaseNumber, Subject, ...
    Please note that if the field is custom, you will need to append "__c" after the Field name
  • Comparator - this basically specifies the actual logic to use for the comparison, for example, you may want to make sure that certain attributes are equal to a specific value, or certain attributes are greater than a certain number.
  • Value - this is the actual value you want to compare with.

You can specify as many of these are you like as part of a query (all of the conditions you specify MUST be satisfied by the elements in the result set).


e.g.: {salesforce-xxx:<sobject_name>|<field1><comparator1><value1>|<field2><comparator2><value2>|<field3><comparator3><value3>...}

Example 1: Basic String Comparison

Name=Genepoint

Extracting this out to the 3 basic components we get:

Field

Name

Comparator

=

Value

Genepoint

This is quite a simple query that translates to the condition "give me everything which has the Name of 'Genepoint'"

Example 2: Advanced String Comparison

Name=like:point

Extracting this out to the 3 basic components we get:

Field

Name

Comparator

=like:

Value

point

Here, we notice something a bit different, the Comparator is much longer than the first example above, this is the standard format which you can specify different comparators, in this example, we are using the comparator "like" (please refer to #Comparators for more details on what this condition does).

Comparators

To use any of the following comparators (please see #The Condition Structure for more details of where Comparators fit into the whole scheme of things.

Comparator Name

Alias

Availability

Description

Equals

"=", "=eq:"

All

Expression is true if the value in the specified field equals the specified value in the expression. Comparisons using the equals operator are case-insensitive.

Not Equals

"=ne:", "=not equals:"

All

Expression is true if the value in the specified field does not equal the specified value in the expression. Comparisons using the equals operator are case-insensitive.

Like

"=lk:", "=like:"

All

Expression is true if the value in the specified field matches the characters of the text string in the specified value. The LIKE operator is similar to the SAME operator in SQL; it provides a mechanism for matching partial text strings and includes support for wildcards.

  • Wild cards are automatically appended before and after the specified value
  • The text string in the specified value must be enclosed in single quotes.
  • The LIKE operator is supported for string fields only.
  • The LIKE operator performs a case-insensitive match, unlike the case-sensitive matching in SQL.
  • Do not use the backslash character in a search except to escape a character.
  • For example, the following query matches Appleton, Apple, and Bappl, but not pl:
    Name=like:ppl

Greater Than

"=gt:", "=greater than:", "=after:"

Numeric/Date

Expression is true if the value in the specified field is greater than the specified value. For dates, the format MUST be "yyyy-MM-ddTHH:mm:ssZ"

Greater Than Or Equal To

"=gte:", "=greater than or equal to:"

Numeric/Date

Expression is true if the value in the specified field is greater than or equal to the specified value.

Less Than

"=lt:", "=less than:", "=before:"

Numeric/Date

Expression is true if the value in the specified field is less than the specified value. For dates, the format MUST be "yyyy-MM-ddTHH:mm:ssZ"

Less Than Or Equal To

"=lt:", "=less than or equal to:"

Numeric/Date

Expression is true if the value in the specified field is less than, or equals, the specified value.

In

"=in:"

All

If the value equals any one of the specified values. For example:
FirstName=in:John,Paul,Bill
Note that the values for the In condition is comma separated list of values.

Not In

"=not in:"

All

If the value does not equal any of the specified values. For example:
FirstName=not in:John,Paul,Bill
Note that the values for the Not In condition is comma separated list of values.

Includes

"=includes:"

Multi-Select Fields

Includes (contains) the specified string. You can use ";" to specify AND for two or more strings. Use ; for multi-select picklists when two or more items must be selected. For example: AAA;BBB. You can have multiple includes by specifying a comma separated list of values

Excludes

"=excludes:"

Multi-Select Fields

Excludes (does not contain) the specified string. You can use ";" to specify AND for two or more strings. Use ; for multi-select picklists when two or more items must be selected. For example: AAA;BBB. You can have multiple excludes by specifying a comma separated list of values

Between

"=between:"

Numeric/Date

Expression is true if the value in the specified field is greater than or equal to the specified lower limit AND the value in the specified field is less than or equal to the upper limit. Example: Amount=between:5000,10000 will restrict the results to only those that have an Amount between 5000 and 10000. For dates, the format MUST be "yyyy-MM-ddTHH:mm:ssZ"

Note About Includes/Excludes

A match will result on any field value that contains 'AAA' and 'BBB' or any field that contains 'CCC'. For example, the following will be matched:

  • matches with AAA;BBB:
    • AAA;BBB
    • AAA;BBB;DDD
  • matches with CCC:
    • CCC
    • CCC;EEE
    • AAA;CCC

These comparator descriptions includes excerpts from the SalesForce API.