Jira->ADO sync by Project name

I whish to sync among thousands of projects only the hundreds of the ones that have the project name starting with “PN-”, like “PN-999999”, but neither “~” nor “*” are valid operators to query the project name.

As such I was not able to do a valid trigger, my workaround was to sync by using a label as trigger and add the clause:

if ((issue.project?.name ==~ /PN-.*/)) {    
// ...sync logic...
}

My question is this the best approach?

Hi @Vasco

Thanks for raising this question. I would understand the use case.

Here are few questions i would like to ask:

  1. What are the 2 systems included?
  2. From your question , it seem there will be Jira but is it Jira cloud or Jira On-prime ?
  3. All hundred projects’ issues/workitems starts with PN only?

Waiting for your response!

Thanks,

Sonal

Hi Sonal;
Indeed my details were sparce..
I’m trying to connect Jira Cloud → to → ADO
and yes, the hundreds of project’s that the name start’s with “PN-” have an issue key that start with “PN”. followed by a number like “PN999999-<issue#>”, but not all issues keys that start with “PN” are from projects that the name is “PN-*”, as there can be a project key “PNull-#” for a completely different project type.

Hi @Vasco

You’ve hit a well-known JQL limitation—the project field doesn’t support wildcard or regex matching. Your regex workaround in code is actually a reasonable approach, but let me outline the options:

Options to Consider

1. Project Categories (Recommended if feasible)

If you can organise all your “PN-*” projects under a dedicated Jira category, you can use jql

category = "Your-PN-Category"

This is the cleanest JQL-native solution and would scale automatically as new PN-* projects are added.

2. Dynamic JQL via API

Use the Jira REST API to first fetch all projects, filter those starting with “PN-”, then programmatically build your JQL:

jql

project IN ("PN-999999", "PN-888888", "PN-777777", ...)

This could be regenerated periodically or on-demand.

Cons: you may hit JQL length limits (~65k chars)

3. Your Current Code-Level Filtering

Your regex approach is valid and flexible:

groovy

if ((issue.project?.name ==~ /PN-.*/)) {
    // sync logic
}

Pros: Simple, works reliably, handles edge cases like “PNull”
Cons: You’re still fetching/processing issues you’ll discard, which may impact performance at scale

4. Label or Custom Field Trigger (Hybrid)

Add a specific label (e.g., sync-to-ado) to relevant projects and combine:

jql

labels = "sync-to-ado"

Then keep your regex as a safety check.


My Recommendation

Given you’re syncing Jira Cloud → ADO with hundreds of projects:

  1. If you control project setup: Use Project Categories—it’s the most maintainable solution

  2. If categories aren’t practical: Your current approach (label trigger + regex validation) is solid. The regex ensures you don’t accidentally sync “PNull” projects

Let me know if you need any further assistance.

Thanks,

Sonal