- Overview
- Field types
- Value rules for user and group fields
- Setup
- How it works
- Changelog and issue update events
- Field context configuration
- Examples
- Scripted text field - priority + status
- Scripted number field - days since creation
- Scripted number field - sum subtask story points
- Scripted date field - due date + business days
- Scripted datetime field - last comment timestamp
- Scripted paragraph field - rich text summary
- Scripted paragraph field - plain string
- Scripted user field - assignee of the parent issue
- Scripted user list field - everyone watching the issue
- Scripted group field - duty group of the project
- Scripted group list field - groups that must see a high priority issue
- Next steps
Overview
Scripted Fields are read-only computed custom fields whose values are calculated by scripts on issue create and update. Nine field types are available, each with its own trigger: Custom Field (Text), Custom Field (Number), Custom Field (Date), Custom Field (Datetime), Custom Field (Paragraph), Custom Field (User), Custom Field (User List), Custom Field (Group) and Custom Field (Group List).
Scripted Field vs JQL Function? A Scripted Field stores a value on each issue. A JQL Function takes a query parameter and returns a set of matching issues at search time. Use a JQL function when the matching logic involves linked-issue traversal, cross-issue computations, or arguments supplied by the user at search time.
Field types
| Type | Script returns | Example use case |
|---|---|---|
| Scripted Text Field | String | Concatenated fields, formatted status |
| Scripted Number Field | Number | Computed scores, subtask point totals |
| Scripted Date Field | Date string (ISO format, date only) | Business day calculations, SLA dates |
| Scripted DateTime Field | DateTime string (ISO format with time) | Timestamp calculations, deadline tracking |
| Scripted Paragraph Field | ADF document (Atlassian Document Format) or a plain string | Rich text content, formatted descriptions |
| Scripted User Field | Account ID string, or a user object with accountId |
Derived owner, escalation contact |
| Scripted User List Field | Array of account IDs or user objects | Derived reviewer or stakeholder sets |
| Scripted Group Field | Group name string, or a group object with name |
Derived routing or ownership group |
| Scripted Group List Field | Array of group names or group objects | Derived approver or notification groups |
User and group fields are native Jira field types, not text fields holding an account ID. Jira renders them as it renders any user or group field (avatar and display name, group link) and indexes them, so they work in JQL - for example "Last status changer" = currentUser() or "Duty group" in ("jira-administrators").
Value rules for user and group fields
The script returns an identifier (or a whole user or group object); Studio writes it to Jira as the object Jira expects for that field type:
| Field | Value sent to Jira |
|---|---|
| Scripted User Field | { "accountId": "5b10a2844c20165700ede21g" } |
| Scripted User List Field | Array of { "accountId": ... } objects |
| Scripted Group Field | { "name": "jira-administrators" } |
| Scripted Group List Field | Array of { "name": ... } objects |
What the script may return:
- User fields accept an account ID string or any object with an
accountIdproperty, so returning a whole user object works:return await Users.get(...). - Group fields accept a group name string or an object with a
nameproperty. An object carrying only agroupIdis rejected - Studio writes groups by name, and resolving an ID into a name would need an extra API call per value. - List fields accept an array. Every item goes through the same conversion, items that cannot be converted are skipped, duplicates are removed, and at most 100 items are written.
- Anything that cannot be converted results in an empty field - the issue view never breaks because a script returned the wrong shape.
- When a value (or part of a list) is dropped, the reason is recorded as a failed entry in Admin Panel → Audit Log → Script Runs, naming the field and what was wrong. This needs auditing of Scripted Fields to be switched on in Audit Log → Trigger Types - it is off by default.
Setup
- In the Console, add the matching Custom Field trigger to the script - for example Custom Field (Text) for a Scripted Text Field - and save it
- In Jira, go to Settings > Issues > Custom Fields
- Create a new field of type “Scripted Text/Number/Date/Datetime/Paragraph/User/User List/Group/Group List Field”
- Open the field context’s configuration (the JiBrok Studio script picker) and select the script. Only scripts with a matching Custom Field trigger are listed
- Assign the field to the appropriate screens
How it works
- Scripts run automatically on issue create and issue update, and also on comment, worklog, attachment and issue link events on the issue
- The script receives
issue(RichIssue object) andissueKey(string) - The return value becomes the field value
- If the script errors, nothing is written and the field keeps its previous value
- Scripts always run as Application (not current user)
- Limits: 5 seconds execution, 20 API calls, 20 pending promises per run (see Limits)
- Trigger parameters configured on the Custom Field trigger are available as
params - Writing the value can produce an issue update event - see Changelog and issue update events
Changelog and issue update events
Writing a computed value back into Jira can be recorded in the issue changelog, and a changelog entry is an issue update - everything that watches issue updates can react to it. Which of the two modes applies is decided by the Generate changelog setting of the script’s scripted field trigger, in the script’s Config tab:
Generate changelog - When enabled, field value changes are recorded in the issue changelog and trigger notifications. When disabled, values update silently.
The setting is disabled by default. It belongs to the trigger, so it covers every field and field context computed by that script, and the trigger row shows the current mode as “Changelog: enabled” or “Changelog: disabled”.
Disabled (default)
The value is written silently:
- nothing appears in the issue History tab
- no notifications are sent
- no automation rule, webhook or other app that listens to issue updates is woken up
The cost is that the field has no history: previous values cannot be looked up afterwards, and JQL that reads changelog data (CHANGED) never sees the field.
Enabled
Jira records the value change in the issue changelog, and that record is an issue update. Everything that reacts to issue updates can fire on each recalculation:
- Notifications to watchers, assignee and reporter, per the project notification scheme
- Jira Automation rules triggered by “Issue updated” or “Field value changed”
- Webhooks subscribed to
jira:issue_updated - any other app subscribed to issue update events
Scripted fields are recomputed on every issue create and update - and on comment, worklog, attachment and issue link events too - so a value that changes often produces that many changelog entries and notifications. Enable the setting when the field’s history is worth that traffic, and leave it off for fields that are recalculated constantly.
JiBrok Studio’s own triggers are not affected. Jira events caused by the app are filtered out by ignoreSelf, so a scripted field write never re-triggers event scripts or another round of field computation - see Loop prevention.
Bulk recalculation is always silent. The Recalculate Fields recipe writes values without a changelog whatever the trigger setting says, so backfilling a large JQL selection never floods watchers with notifications.
Field context configuration
A field context defines the scope where a scripted field applies - by project and issue type combination. Different field contexts can use different scripts, allowing context-specific calculations.
How contexts work
- Each custom field in Jira has one or more field contexts (configured in Jira Administration - Custom Fields)
- A field context specifies which projects and issue types the field applies to
- JiBrok Studio allows you to assign different scripts per field context
- When a field is calculated, the system determines which context applies based on the issue’s project and type, then runs the corresponding script
Configuring context-specific scripts
- In Jira Administration - Custom Fields, open the scripted field and pick a field context
- Open that context’s configuration (the JiBrok Studio script picker)
- Select the script to use for that context and save
- Repeat for other contexts. Saving with no script selected removes the script from that context
Context synchronization
Field context mappings are automatically synced from Jira. When you create, update, or delete field contexts in Jira Administration, JiBrok Studio receives events and updates its local cache; saving a field configuration also syncs that field’s contexts immediately. To check that the stored configurations still match the contexts in Jira, use Field Context Integrity in Admin Panel -> Admin -> Health Check (see Administration).
If a scripted field’s custom field is deleted in Jira, JiBrok Studio skips it on the next issue event and turns off its stored configuration; the other scripted fields of the issue and the event scripts are still processed.
Recalculating after changes
When you change a script or context configuration, existing field values are not automatically updated. Use the Recalculate Fields recipe to batch-update values for all matching issues.
Examples
Scripted text field - priority + status
return `${issue.priority} - ${issue.status}`
Scripted number field - days since creation
return issue.age
Scripted number field - sum subtask story points
let subtasks = Issues.search(`parent = ${issueKey}`, {
fields: ['customfield_10016'] // Story Points
})
let total = 0
for (let sub of subtasks.issues) {
total += sub.fields.customfield_10016 || 0
}
return total
Scripted date field - due date + business days
const due = DateUtils.addBusinessDays(issue.created, 14)
return DateUtils.format(due, 'YYYY-MM-DD')
Scripted datetime field - last comment timestamp
const comments = issue.getComments()
if (comments.length > 0) {
return comments[comments.length - 1].created
}
return null
Scripted paragraph field - rich text summary
return Adf.doc(
Adf.heading(3, 'Summary'),
Adf.paragraph(Adf.bold('Priority: '), issue.priority),
Adf.paragraph(Adf.bold('Status: '), issue.status)
)
Scripted paragraph field - plain string
A plain string is wrapped in ADF automatically:
return `Priority: ${issue.priority}\nStatus: ${issue.status}`
Scripted user field - assignee of the parent issue
if (!issue.parent) return null
const parent = await Issues.get(issue.parent)
return parent.assigneeId
Scripted user list field - everyone watching the issue
// Watcher objects carry accountId, so they can be returned as they are
return await issue.getWatchers()
Scripted group field - duty group of the project
return issue.project === 'OPS' ? 'ops-duty' : 'support-duty'
Scripted group list field - groups that must see a high priority issue
const groups = ['jira-users']
if (issue.priority === 'Highest') groups.push('incident-responders')
return groups
Next steps
- Triggers - Scripted field trigger configuration
- Scripting Language - Language and API reference
- Recipes - Recalculate Fields recipe for backfilling values
- Limits - Execution limits
