You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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.
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...
If that is the case, I recommend splitting "query 1" into two parts:
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.
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.
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.