Forums

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

JQL Functions Failing in Automation

Steve Tedeschi
Contributor
May 16, 2025

Problem Statement:

No results are found when using a JQL function in a Jira automation AND the automation is either automatically triggered (e.g., sprint close) or scheduled. However, the same JQL returns results when manually triggering the automation.

The following screen shot shows the audit log; the green section shows results when manually triggered. The red section shows the same automation after being scheduled.

JQL in Automation.pngAdditional Background:

The objective of the automation is to identify sprint changes; tickets and story points added / removed from a sprint. There is a similar automation exists that uses the addedAfterSprintStart function, instead of removedAfterSprintStart. 

FYI - variables (e.g., sprintEvent, boardName) are used so the automations can be used in different projects by updating these "configurations". Since the automation is scheduled, the automation doesn't have access to Sprint smart values. The For JQL block is selecting a specific issue that contains the Sprint details.

 

FYI - This question previously posted on different thread. That thread hasn't been active. Hoping this reframes the question and the screenshot above clearly shows the issue.

2 answers

0 votes
Rudy Holtkamp
Community Champion
May 16, 2025

Hi @Steve Tedeschi ,

The first thing that comes to mind is that the scope of your automation rule is not wide enough. So you will only get issues (uhum work items) of one project. Which might be zero. 
Did you check the rule scope?

Steve Tedeschi
Contributor
May 16, 2025

I thought this maybe a factor because the filter for the board can include issues from other projects (all issues from the other project are resolved). I tried 'duplicating' the board with an amended filter for just my project without success.

If project scope were a factor, I would think the JQL would return also return no results when manually triggered.

0 votes
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.
May 16, 2025

Hi @Steve Tedeschi 

First, you note your earlier question has not been active.  Have you tried responding to ask for more help?

 

Next, the log entries you show do not appear to match the rule image.  Please show images of:

  • the complete rule in one single image file for continuity
  • the rule trigger
  • the complete audit log entry for when the rule did not work as expected

 

Until we see those, please note there is an open defect for using ScriptRunner functions in JQL with a scheduled trigger rule: https://jira.atlassian.com/browse/JIRAAUTOSERVER-1095

 

Kind regards,
Bill

Steve Tedeschi
Contributor
May 16, 2025

@Bill Sheboy - Thanks for feedback... trying to tackle your questions in order.... let me know if I miss anything

Please let me know how best to request additional help on an existing post.

Please see full screenshot below. The "worked" run was manually triggered and is highlighted in green. The "failed" run was scheduled.

I think you're right and my issue is related to JIRAAUTOSERVER-1095. That Issue mentions the same functions I am using. Do you know if the issue is limited to those or all issue functions (e.g., portfolioChildrenOf are also problematic)?

JQL in Automation 2.png

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.
May 17, 2025

Starting with the original symptom, that defect does seem to be the problem.  I suggest contacting the vendor for ScriptRunner or Atlassian to learn which functions are impacted by the defect.

 

Reviewing your rule, I observe it has a branch on JQL and creates variables inside.  Branches which could span more than one issue are run in parallel and asynchronously, and there is no guarantee when the branch will complete, up until the last step of the rule.

For your rule, this means the steps after the branch will likely start running before the branch finishes.  And, each of the variables created inside go out of scope and disappear after the branch. 

Are you trying to use those variables in the steps shown after the branch?  If so, that will not work as expected.

Steve Tedeschi
Contributor
May 19, 2025

@Bill Sheboy Accepting answer because my issue is same as JIRAAUTOSERVER-1095. Is there a way I can 'watch' that ticket to see if/when is gets scheduled? There hasn't been activity in ~4 months so not hopeful :-(

 

Thanks for the advice on the loop. While I haven't encountered any issues in my testing, restructured my Automations to incorporate your feedback.

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.
May 19, 2025

Yes: please select the "Watch" option at the top-right of that defect and you will get email notifications. 

If you have not already done so, you will need to sign up to the public backlog (using your Atlassian account).

Suggest an answer

Log in or Sign up to answer