Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Updating a filter JQL query via REST API in JIRA automation based on input from another filter JQL q

Hi all,

I want to update a filter JQL query via REST API in JIRA automation based on input from another filter JQL query.
It's a bit similar to the to the topic described here: https://community.atlassian.com/t5/Jira-Software-questions/Updating-a-filter-JQL-query-via-REST-API-in-JIRA-automation/qaq-p/2475467

I have JQL query 1 in this systematic:
(issuekey in portfolioChildIssuesOf(PDI-482) or issuekey in portfolioChildIssuesOf(PDI-483)) AND "Scrum Team[Select List (multiple choices)]" in ("X Team") and issuetype in (Bug, Story) AND "Completion Date[Date]" >= "-12w" and status in (online, done)

I want to dynamically change this part of the JQL: PDI-482, PDI-483, etc.

Therefore I have another JQL query 2 like this:
("Scrum Team[Select List (multiple choices)]" in ("X Team") and issuetype in (PDI) AND "Completion Date[Date]" >= "-12w" and status in ("development completed", done, "Launch Validation", Closed, Rejected)) OR ("Scrum Team[Select List (multiple choices)]" in ("X Team") and issuetype in (PDI) and status in (scheduled, development))

I want to put the results from query 2 in the form of (issuekey in portfolioChildIssuesOf(PDI-482) in query 1 on a regular basis.

I don't have much experience with using REST API so I would be really happy if you have either learning resources about that or a specific idea how I could implement my use case. 

Kind regards and thanks a lot for your help and support.
Mathias

1 answer

1 vote
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.
Oct 25, 2023

Hi @Mathias Minsel 

First thing, here is a how-to article for calling a REST API function from an automation rule: https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

I recommend creating a basic rule which returns your saved query to confirm everything is working before proceeding.

 

Next, when you describe wanting to use the results of your "query 2" to update "query 1", I am unclear what you mean...

Does "query 2" always return 2 issues, and you want those to replace the current values, such as PDI-482 and PDI-483?  Or, do you meant that "query 2" returns 1-to-many results, and...

  • for each value returned by "query 2"
    • add an expression to "query 1" of the following
      • issuekey IN portfolioChildIssuesOf(someKeyFromQuery2)
      • where multiple expressions are concatenated with an OR operator
  • and then use the REST API to update the saved "query 1"

If that is the case, I recommend splitting "query 1" into two parts:

  1. put everything unrelated to the portfolioChildIssuesOf() checks in a new saved filter, which we can name as "query 0"
  2. simplify "query 1" to filter = "query 0" AND (some list of porfolioChildIssuesOf checks)

This will reduce the complexity of the "query 1" updates, as now you can do a simple replacement, based upon the results of the "query 2" lookup.

Kind regards,
Bill

Hi Bill,

thanks a lot for your reply. I will take a bit time to digest the article you suggested.

Regarding your question, "query 2" returns 1-to-many results and I want to use all of them with concatenated with an OR operator in query 1.
I also really like your suggestion to split this up in query 1 and 0.

Like Bill Sheboy likes this
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.
Oct 26, 2023

I suggest using the Lookup Issues action to gather the results from "query 2"; that will make it easier to then build the dynamic JQL to add to your "query 1" using text functions.

Like Mathias Minsel likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events