Docs
On this page
reference2 min readApplication: Platform

Query functions

Fields of relationship and field query functions, which supply values such as the current user or year to date in filters and question defaults.

A query function supplies a value at the moment a filter or default is used, such as the signed-in user or the dates of this year. This page lists the fields of both kinds of query function, for administrators with the administrator role.

Kind Used on Menu
Relationship query function Reference and multiple reference fields, and catalog question defaults Data model → References & queries → Relationship query functions
Field query function Other field types, mainly dates and IDs Data model → References & queries → Field query functions

The menu paths are in the Administration workspace. In a filter, select the lightning bolt icon next to a field to see the functions available for it.

The Field query functions and Relationship query functions items in the References & queries section of the Data model menu.

Relationship query functions

A relationship query function returns a record ID or a list of IDs. Use it in two places:

  • in a list or report filter, for example “Assignee is Current user” to find your own incidents
  • in Default from function on a catalog question, to default the answer, for example to the requester
The lightning bolt next to an Assignee filter rule, offering Current user.
Field Type Behaviour Purpose
Name Text Shown when you pick the function. Names the function, for example “Current user location”.
Function name Text Used when the function runs. The internal name, for example currentUserLocation.
Number of expected arguments Number How many arguments the function takes, usually 0.
Supported entities List of tables The function is offered only for fields and questions that reference these tables. Limits where the function appears, for example Location.
Returns list? Yes or no Turn on if the script returns a list.
Active Yes or no Only active functions are offered.
Script Script The value of the last expression is returned. Produces the ID or IDs, for example user.Location.value();.

The platform ships three: currentUser, currentUserGroups and globalOrganization. The Current user function’s script is user.getID();.

A catalog question defaulted from the Current user function.

Field query functions

A field query function returns a value or a date range for list and report filters, for example “Created is YTD”.

Field Type Behaviour Purpose
Name Text Shown when you pick the function. Names the function, for example “YTD”.
Function name Text Used when the function runs. The internal name, for example yearToDate.
Number of expected arguments Number How many arguments the function takes, usually 0.
Supported field types List The function is offered only for these field types. Limits where it appears, for example date and date_time.
Returns list? Yes or no Turn on if the script returns a list.
Returns range? Yes or no Turn on if the script returns a start and an end.
Active Yes or no Only active functions are offered.
Script Script The value of the last expression is returned. A range is an array of start and end. Produces the value.

The ITSM, Knowledge and HR applications ship approval functions, such as itsmWorkMyApproval and changeMyApproval. Each returns the records with an open approval task for the signed-in user. Lists such as “Work awaiting my approval” use them. A task with no parent record is skipped.

The two scripts below are examples of date functions.

Year to date, with Returns range? on:

let end = DateTime();
let start = DateTime().withMonthOfYear(1).withDayOfMonth(1).toStartOfDay();
[start, end];

Last year, with Returns range? on:

let end = DateTime().minusYears(1).withMonthOfYear(12).withDayOfMonth(31).toEndOfDay();
let start = DateTime().minusYears(1).withMonthOfYear(1).withDayOfMonth(1).toStartOfDay();
[start, end];
Last updated 3 December 2026commit 6777698daac5Chris Jones
Back to top