Skip to main content

Clauses

A FOQL query is built from clauses in a fixed order: selectfromwheregroup byorder bylimitoffset. Only select and from are required.

SELECT#

The select list contains one or more comma-separated select items. Each item is either:

  1. a field path — a field name (subject), or a dotted lookup traversal (vendor.name, vendor.moduleState.displayName); or
  2. an aggregatesum(...), avg(...), min(...), max(...), count(...).

Each item may optionally be followed by as <alias> to rename the column in the response. See Aggregates & Aliases.

FROM#

A single module API name — the base module. In the reference query this is workorder. The base module determines which fields and lookups are addressable.

select id, subject from workorder

WHERE#

A boolean condition tree. Group conditions with parentheses to control precedence and avoid ambiguity:

where (priority = 'Low' and status = 'Open') or totalCost > 5000

The comparators allowed in a predicate depend on the field type of the left operand — see Field Types & Their Comparators.

WHERE constraints
  • A where clause may contain a maximum of 25 criteria conditions.
  • Multi-line fields such as Description, Terms and Conditions, Comments, and similar cannot be used in the where criteria.

GROUP BY#

A comma-separated list of fields. When the select list mixes aggregate functions with non-aggregated (scalar) fields, every scalar field must appear in group by.

select category, status, sum(totalCost)from workordergroup by category, status

ORDER BY#

A comma-separated list of fields (or aliases), each optionally suffixed with asc (default) or desc. Sorting is applied left to right.

order by createdTime desc, id asc

LIMIT / OFFSET#

limit caps the number of records returned in this call; offset skips that many records from the start of the result set. Together they implement pagination:

limit 100 offset 0     -- page 1limit 100 offset 100   -- page 2
tip

A single call can return at most 2,000 records. See Limits & Validations.