Script Console

The Script Console has an intelligent code editor with knowledge of your Jira instance. It's designed for running one-off scripts.

It's where you try things out. Most scripts start here, get adjusted until they do the right thing, and only then get saved to the Script Library or attached to a listener, a scheduled job, or a workflow rule.

The Script Console as it opens: the Examples and Field Lookup toolbar, an empty editor, the Run button, and the Run as toggle

The Script Console, ready for a script

What you write is covered in How It Works. This page is about the console itself.

Running a Script

Write your script, choose who it runs as, and click Run. Output appears while the script is still running, so a long job shows you where it has got to instead of sitting silent. Every line you print() arrives as it happens. Changes are still held back until the script finishes, and you'll see a running count as they're then applied to Jira. The finished result replaces the live view when the run ends.

The output panel during a run: a Running badge, printed lines arriving one per work item, and a counter reading Applying changes to Jira, 14 of 30

A script mid-run: output as it's printed, then the count of changes landing in Jira

The Run as setting decides whose permissions the script has and whose name lands on any changes. New scripts default to your own account. Learn more about the PyRunner user →

The row below the editor: the Run button on the left, and a Run as toggle on the right set to PyRunner rather than Jack Dillon

Run, and who the script runs as

Stopping a run

Cancel appears while a script is running and stops it. Nothing is written to Jira, because changes apply only when a script finishes cleanly. A cancelled run leaves Jira untouched.

The same row while a script is running: a spinner, then a yellow Cancel button in place of Run

Cancel, while the script is still running

Note: Cancel stays available for as long as the script is running, however long that turns out to be.

Saving the script

The console is for one-off scripts. Anything you want to keep belongs in the Script Library, which is where scripts are created, organized into folders, and edited.

You can also save straight from the console with Cmd/Ctrl-S. Give the script a name and it's added to the library, and you're taken to the Script Library with it open, ready to keep working on.

The New script dialog: a name box ending in .py, a hint that a slash puts the script in a folder, and a Create button

Naming the script on save

The shortcut works anywhere on the console page, not just inside the editor, so you don't have to click back into your code first.

Reading the Results

Results appear below the editor, on two tabs.

Output

Everything the script produced, in the order it happened: anything you print()ed, then the value of result. A DataFrame or a list of dictionaries renders as a table you can sort, search and export, covered in Smart Table. If the script changed anything in Jira, those changes are summarised underneath.

Here's an example that counts the open work items per assignee, which the Output tab renders as the sortable table on the right.

The script in the Script Console: a search, a DataFrame of assignee and points, and a groupby summary

The script

The Output tab showing the returned DataFrame as a sortable table of assignee, issues and points, with CSV, Excel, Copy and Show raw data below it

What comes back

Logs

When a script fails, the error is here: the message and the line it happened on. The panel switches to this tab on its own, so you don't have to go looking, and the editor marks the failing line so you can see it in place.

On a run that worked, the Logs tab confirms it and shows how long the script took.

Note: Applied changes are on the Output tab, not Logs. Logs is for what went wrong.

Editor Tools

Four buttons sit above the editor. You'll find the same four wherever you write a script in PyRunner, since listeners, scheduled jobs, workflow rules, and behaviours all use this editor.

ButtonWhat it's for
ExamplesReady-made scripts to start from
Field LookupEvery field on your site, with its id and the line to copy
Full screenThe editor fills the window, toolbar included
ThemeThe editor's color scheme

Examples is useful if you're not sure where to start. The scripts vary in complexity and cover a wide range of automated tasks. Choose one and it replaces what's in the editor.

The Examples browser: a list of examples on the left, the selected example's script previewed on the right, with a Use this example button

Examples, with one script previewed

Field Lookup lists every field on your site with its id, its type, and the exact line to read it in Python. Most fields read by name, but if two share a name you'll need the field id instead. The line it gives you already accounts for that.

The Field Lookup table searched for story, showing Story point estimate and Story Points with their ids and the Python line that reads each

Field Lookup, with the line to copy for each field

Theme changes the editor's color scheme. There are six to choose from, ported from the VS Code themes of the same names, with a tick against the one you're using.

The Theme dropdown listing Dark Modern, Light Modern, Monokai, Tokyo Night, Dracula and GitHub Light, with Light Modern ticked
The six editor themes

The theme you pick here applies to every editor in the app, including the Script Library and the example previews, and it's remembered between visits.

Smart Table

Any result that's a table, either a DataFrame or a list of dictionaries, comes back as one you can work with rather than text you have to read. This script pulls every unfinished work item into one:

Python
items = jira.search(
    "statusCategory != Done",
    fields=["summary", "status", "assignee", "priority", "duedate", "story_points"],
    limit=200,
)

result = pd.DataFrame([{
    "Key": i.key,
    "Summary": i.summary,
    "Status": i.status,
    "Assignee": i.assignee or "Unassigned",
    "Priority": i.priority,
    "Points": i.story_points,
    "Due": i.due_date,
} for i in items])
The result table: work item keys as links, coloured status badges, right-aligned points, friendly dates, a search box, and CSV, Excel, Copy and Copy as JQL buttons

Keys link to their work item, and the buttons take the result with you

Sort any column
Click a header to cycle ascending, descending, off. Numbers and dates sort as themselves, and blanks sit at the bottom.
Filter as you type
The search box matches every column at once. Search none to find the rows missing a value.
Keys open their work item
A column of work item keys becomes links, each opening that item in a new tab, so the table you were reading is still there when you come back.
Copy as a Jira table
Copy puts a real table on the clipboard: paste it into a comment and it arrives as a Jira table, paste it into Sheets and it lands in cells.
Copy as JQL
Turns the key column into key in (…). It earns its place when the script chose the rows rather than the query: filter in pandas, then open exactly those items where bulk edit lives.
CSV and Excel
Download the whole result. Copy takes what you are looking at, filtered and sorted; the downloads take everything, including rows past the on-screen limit.
Values keep their shape
A handful of repeated values renders as badges, dates read as dates, and anything clipped to fit shows in full on hover.
It says what it is not showing
Past 5,000 rows the table says how many it held back and where the rest are, instead of letting a row count read as the whole answer.

Need Additional Help?

If you have any questions or need assistance, our support team is here to help

Contact us at: support@pallas-apps.com