JQL Functions

ScriptForge adds 11 custom JQL functions to Jira's query language. These let you build powerful searches that go beyond Jira's built-in JQL capabilities.

Available Functions

scriptForgeFunction(scriptName)

Run a custom script that returns a list of issue keys. The most flexible function — your script determines which issues match.

issue in scriptForgeFunction("high-risk-issues")

hasSubTasks()

Find issues that have at least one sub-task.

issue in hasSubTasks()

Use case: Find parent issues for sprint planning, identify stories that have been broken down.

subTasksOf(jqlQuery)

Returns sub-tasks of issues matching the given JQL.

issue in subTasksOf("project = WEB AND type = Story AND sprint in openSprints()")

Use case: View all sub-tasks for the current sprint's stories, track task-level progress.

linkedIssuesOf(jqlQuery)

Returns issues linked to issues matching the given JQL.

issue in linkedIssuesOf("key = PROJ-100")

Use case: Find all dependencies of a specific issue, impact analysis.

parentsOf(jqlQuery)

Returns parent issues of issues matching the given JQL.

issue in parentsOf("status = Blocked AND type = Sub-task")

Use case: Find which stories have blocked sub-tasks.

epicsOf(jqlQuery)

Returns the epics that contain issues matching the given JQL.

issue in epicsOf("priority = Critical AND status != Done")

Use case: Identify which epics have critical outstanding work.

issuesInEpics(jqlQuery)

Returns all issues belonging to epics matching the given JQL.

issue in issuesInEpics("labels = Q4-release")

Use case: See all work items for a specific release train.

commented(jqlQuery)

Returns issues that have been commented on by users matching criteria, or issues with comments containing specific text.

issue in commented("by currentUser() after startOfWeek()")

Use case: Find issues you've engaged with recently.

lastUpdatedBy(username)

Returns issues where the last update was made by a specific user.

issue in lastUpdatedBy("john.smith")

Use case: Review recent work by a team member, handoff tracking.

hasAttachments()

Find issues with at least one attachment.

issue in hasAttachments()

Use case: Find bug reports with screenshots, issues with design files attached.

watched()

Returns issues the current user is watching.

issue in watched()

Use case: Personal tracking dashboard, monitor issues of interest.

Combining with Standard JQL

These functions work alongside regular JQL operators:

project = WEB AND issue in hasSubTasks() AND status = "In Progress"
type = Bug AND issue in linkedIssuesOf("type = Incident AND priority = Critical") AND status != Done
project = API AND issue in subTasksOf("sprint in openSprints()") AND assignee = currentUser()

scriptForgeFunction — Custom JQL Scripts

The scriptForgeFunction is the most powerful — it runs a named script that returns matching issue keys:

Example: Find issues overdue by more than 7 days

Create a script named "overdue-7-days":

const results = await WorkItems.search('dueDate < -7d AND status != Done');
const keys = [];
await results.forEach(issue => {
  keys.push(issue.key);
});
return keys;

Then query:

issue in scriptForgeFunction("overdue-7-days")

Example: Issues with more than 5 comments

Create a script named "heavily-discussed":

const results = await WorkItems.search('project = WEB AND status != Done');
const keys = [];
await results.forEach(async issue => {
  const comments = await issue.getComments();
  if (comments.length > 5) {
    keys.push(issue.key);
  }
});
return keys;

Performance Notes

  • JQL functions execute when the search runs — complex scripts may slow down search results
  • scriptForgeFunction is the most flexible but potentially slowest; keep scripts efficient
  • Built-in functions like hasSubTasks() and hasAttachments() are optimized and fast
  • Avoid nesting multiple custom JQL functions in a single query