Scriptline / Docs / Scripted field
Scripted field
Last updated 03/11/2026
Scripted field (Scriptline) is a read-only custom field whose value your script computes per work item. It is shown on the work item view, stored, and searchable in JQL.
Set it up
- Open Scripted field in the sidebar and click New field hook. The Console opens with the onField kind selected.
- Write a script that receives
context.issue = { id }and returns the value (turned into text, up to 255 characters). - Click Run to try it against a real work item, then save and enable it.
- Add Scripted field (Scriptline) to your screens: Jira Settings → Work items → Screens.
- Open a work item: the field shows the computed value.
One field, one computing hook: keep exactly one onField hook enabled (if several are, the first alphabetically wins). A failing script records the error in Run history and leaves the field empty. A broken script never breaks the work item view.
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;