Browse documentation

Hooks / Docs / Scripted field

Scripted field

Last updated 24/08/2026

Scripted field (Hooks) is a read-only custom field whose value your script computes per work item — shown on the issue view, stored, and searchable in JQL.

  1. Save a hook with kind onField and enable it. It receives context.issue = { id } and returns the value (stringified, max 255 characters).
  2. Add Scripted field (Hooks) to your screens: Jira Settings → Issues → Screens.

One field, one computing hook — keep exactly one onField hook enabled (if several are, the first alphabetically wins). A failing script records the error to Run history and leaves the field empty; an issue view is never broken by a broken script.

Example — risk score

const issue = await jira.getIssue(context.issue.id, ['priority', 'duedate', 'labels']);
const f = issue.fields;
let score = f.priority?.name === 'Highest' ? 50 : 10;
if (f.duedate && new Date(f.duedate) < new Date()) score += 30;
if ((f.labels ?? []).includes('customer-escalation')) score += 20;
return 'Risk: ' + score;