item.getField(fieldId) reads any field of an item — a built-in field such as title or assignee, or a custom field by its field id — and returns a plain value: a string, a number, a boolean, null, an array or a plain object. The shape depends on the field’s type and is the same in JavaScript and in Gonja templates.
In backend scripts, item.setField(fieldId, value) accepts the same shapes, so a value you read can be written back as is. Values are converted and validated exactly as when a person edits the field; a value the field cannot hold is refused with {success: false, error} instead of being stored.
Tip
Field ids are per group. Find them in the group’s item type settings, or list them from a script with group.getFields(itemTypeId), which returns {id, name, description, type, icon} for every field of the type.
Values by field type#
| Field type | getField returns | Unset | setField also accepts |
|---|---|---|---|
Text (string) | "text" | null | |
Rich text (html) | "<p>html</p>" | null; built-in description "" | |
| Number | 42.5 | null | a numeric string |
| Boolean | true / false | null | |
Date (dateOnly) | "2026-05-06T00:00:00Z" | null | "2026-05-06" |
Date and time (dateTime) | "2026-05-06T08:00:00Z" (always UTC) | null | any RFC 3339 string, e.g. "2026-05-06T10:00:00+02:00" |
| Status | the status id, "open" | null | |
| User | the user id | null | |
| Users | ["userId", …] | [] | |
| Item reference | the item id | null | |
| Item references | ["itemId", …] | [] | |
| Group reference | the group id | null | |
| Group references | ["groupId", …] | [] | |
| Dropdown | the option id | null | |
| Dropdowns (multi) | ["optionId", …] | [] | |
| Event | an event object | null | |
| Events | an array of event objects | [] | |
| Attachment | an attachment object | null | not writable with setField |
| Attachments | an array of attachment objects | [] | not writable with setField |
setField(fieldId, null) clears a field.
Important
Dropdown, status and reference values are ids, not the labels people see. item.getField("priority") === "high" compares against the option id. To show a value the way the app does, use item.renderField(fieldId), which returns the platform’s own HTML for it.
Built-in fields#
The built-in fields follow the same table. Their ids and types:
| Field id | Type | Notes |
|---|---|---|
id | text | the item’s unique id — set by the platform |
title | text | cannot be cleared |
description | rich text | |
status | status | cannot be cleared |
type | text | the item type id |
group | group reference | the item’s own group — set by the platform |
idInGroup | number | the number in the item’s tag (#12, PRJ-12) — set by the platform |
assignee | user | |
author | user | |
subscribers | users | |
dueDate | date | |
created | date and time | |
updated | date and time | set by the platform on every change |
completedDate | date and time | |
attachments | attachments | use the file API |
Most built-in fields are also exposed as properties on the item object — item.title, item.status, item.assignedTo, item.dueDate and so on. The two agree on value, with one difference in Gonja: date properties are time values there, while getField returns ISO strings. Both work with the date() and datetime() functions. See the JavaScript API and the Gonja reference.
Events#
An event field holds calendar entries. Each one reads as:
{
"id": "evt_4f1c…",
"title": "Kickoff",
"description": "",
"start_time": "2026-05-06T10:00:00Z",
"end_time": "2026-05-06T11:00:00Z",
"all_day": false,
"location": "",
"attendees": [],
"categories": [],
"url": ""
}
The keys are the ones the REST API uses. To write an event, pass an object with at least start_time; id is generated when missing, and a date-only start_time ("2026-12-25") is accepted, especially with all_day: true. A single event field takes one object; an events field takes an array.
item.setField("kickoff", { title: "Kickoff", start_time: "2026-12-01T09:00:00Z", end_time: "2026-12-01T10:00:00Z" });
item.setField("milestones", [{ title: "Beta", start_time: "2027-01-15", all_day: true }]);
Attachments#
Each file on an attachment field reads as:
{
"id": "66f1c2…",
"filename": "invoice.pdf",
"contentType": "application/pdf",
"size": 48213,
"uploadDate": "2026-09-23T12:00:00Z",
"author": "userId",
"version": 1,
"versionGroup": "66f1c2…",
"fieldId": "attachments",
"url": "/groupId/attachments/itemId/66f1c2…"
}
Deleted files are not listed. url is the in-app download path; use it as a link or an image source. Files are added, removed and read with dedicated methods — see Files and attachments.
Examples#
// JavaScript
const owner = item.getField("assignee"); // "userId" or null
const reviewers = item.getField("reviewers"); // always an array
if (reviewers.length === 0 && owner) {
item.setField("reviewers", [owner]);
}
const due = item.getField("dueDate"); // ISO string or null
if (due && new Date(due) < new Date()) {
item.setField("overdue", true);
}
{# Gonja #}
{% for it in group.queryItems("completedDate:$empty") %}
<li>{{ it.title }} — due {{ date(it.getField("dueDate")) }},
{{ it.getField("attachments") | length }} file(s)</li>
{# date() prints nothing when the date is unset #}
{% endfor %}