October 26, 2022

ScriptRunner Listener: Project Blacklist

There is no built-in way in the ScriptRunner UI to define a project blacklist. I share my learning here, how to do this.

Current Situation/ Problem Description

In a ScriptRunner Listener configuration, you can either define a Listener to run globally for all projects or only for a list of projects (whitelist)

There is not wait to define a blacklist i.e. a list of projects for which the Listener shall NOT run, from the configuration UI.

Blacklist workaround

Though you can do this with a few line of codes.


The code looks like this:

def issue = event.issue

// Project Blacklist
def projectBlacklist = ["RALB"]
if (projectBlacklist.contains(issue.projectObject.key)) {
    return
}

Enter the list of project keys you want to exclude in the projectBlacklist array.

No comments:

Post a Comment