Quick Start
This walk-through builds three small things: a console script, a panel on every work item, and a web trigger another system can call.
1. Try code in the Script Console
Open Jira settings → Apps → Script Toolkit → Script Console and replace the code with:
const res = await requestJira('/rest/api/3/search/approximate-count', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ jql: 'statusCategory != Done AND assignee = currentUser()' }),
})
const { count } = await res.json()
return `${count} open work items assigned to you`
Press ⌘↵ (Ctrl+↵ on Windows). The result appears below the editor. Console code runs in your browser with your own Jira permissions, and nothing is saved.
2. Add a panel to every work item
-
Open Scripts and choose Fragment.
-
Name it Hello panel and replace the code with:
<div id="out">Loading…</div> <script type="module"> const key = context.extension.issue.key const res = await requestJira(`/rest/api/3/issue/${key}?fields=summary`) const issue = await res.json() document.getElementById('out').textContent = `${key}: ${issue.fields.summary}` setHeight(document.documentElement.scrollHeight + 'px') </script> -
Open the Test tab, enter a work item key, and press ⌘↵ to preview it under the editor.
-
Click Save (⌘S), then open that work item: the panel shows its key and summary.
3. Create a web trigger
- In Scripts, choose Web trigger, name it Echo and set the trigger key to
echo. - Keep the starter code, which returns what it receives, and click Save.
- Under How to call it, copy the example command and run it in a terminal. You get
{"ok":true}back, and the call appears under Logs.
The call needs the secret shown under How to call it; without it, the URL answers 401.
Where to go next
- Put several fragments in one place: they appear as tabs. See Fragments.
- Store an API key as a secret and call another service with
fetch. See Backend scripts. - Let non-admins run bulk changes safely. See Tools.