Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JQL: Match multiple issue keys in incoming webhook

Dan Michael Heggø
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 21, 2022

Hi!

I'm able to match a single issue key using this JQL:

key = "{{webhookData.pull_request.title.match("(CMS-\d+)")}}"

But it fails if the title contains multiple keys. So I tried using the IN operator instead:

key IN {{webhookData.pull_request.title.match("(CMS-\d+)")}}

but it failed since the values are not quoted right or not a proper list?

"(key in CMS-296, CMS-297) AND (project in (XXXX))" - Error in JQL Query: Expected ')' but got ','.

How can I turn the values returned from `match()` into something that can be used with the IN operator?

1 answer

1 accepted

1 vote
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2022

Hi @Dan Michael Heggø  -- Welcome to the Atlassian Community!

When you use the IN operator, JQL expects a list.  Please try to wrap that expression with parentheses, leading to something like:

key IN ( CMS-296, CMS-297 )

And...as you are testing on the keys directly you do not need the project IN (XXXX) expression.

Kind regards,
Bill

Dan Michael Heggø
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 24, 2022

Thanks, adding parentheses helped:

key IN ({{webhookData.pull_request.title.match("(CMS-\d+)")}})

What confused me at first was that I thought I needed quotes around each key, but turns out I don't!

The `project IN ..` is added automatically by Jira btw., since the automation rules are defined in a project, but you're right that they're not needed per se.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events