Create issue if a filter is not empty

Jacob Rosenfeld September 9, 2021

I want to create a jira issue/ticket for a filter if it's not empty and link the tickets. 

 

For example, I have tickets moved to "backlog" but did not enter a "follow up" date, so I have a filter to return those tickets. 

project = KBS AND "Follow Up[Date]" = EMPTY AND type != epic AND resolution is EMPTY ORDER BY created DESC

I want each morning for a new issue to be created linking any tickets that are pulled by this filter with a new issue called "assign dates" or something. When I tried to automate it made a new issue for each issue returned by the filter, not one issue linking all of the issues.

3 comments

Comment

Log in or Sign up to comment
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 9, 2021

Hi Jacob,

You can create a Scheduled trigger in Automation for Jira to do that. 

Like Sarah Elmer likes this
Margareta Buruian September 9, 2021

Hi Jacob, 

As John referenced you can use the scheduled trigger in automation, set the JQL condition (if JQL matches X) then set a new action to create ticket! 

Like Sarah Elmer likes this
Margareta Buruian September 9, 2021

Screenshot 2021-09-09 at 16.47.31.png

Looks like this at a super top level

Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 9, 2021

From the OP, it sounds like the concern is that his rule creates multiple tickets when he wants just one ticket created. I suspect the problem isn't the trigger or using JQL.

Is that right, @Jacob Rosenfeld? If so, it would help us to see a screenshot of your rule (similar to what @Margareta Buruian illustrated above).

Jacob Rosenfeld September 9, 2021

Correct. It wasn't just the issue creation, I also wanted them linked within the issue.

 

This is the rule that made a new issue for each issue returned. 

image.pngimage.png

Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 9, 2021

I notice in your trigger that you have this box checked:

Screen Shot 2021-09-09 at 11.35.21 AM.png

Note how this says that it will execute actions (your "Create issue" component) for each issue in the JQL result.

Have you tried unchecking that box and testing the rule?

Jacob Rosenfeld September 9, 2021

Then I can't run the JQL and nothing happens. 

Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 9, 2021

So it seems that using JQL in the Scheduled trigger isn't going to do what you want.

I'm going back to your OP, where you stated:

I want each morning for a new issue to be created linking any tickets that are pulled by this filter...

To run a rule once per day, you do need to use the Schedule trigger. So uncheck the box and skip the JQL in the trigger component of the rule.

Here is some pseudocode for what I suggest for your rule (after the trigger):

1. Terminate early if no issues match your JQL

2. Create a new issue

3. Loop through the JQL and link to the new issue

For part 1, use a JQL Condition with your JQL. If no issue match, the rule will not continue. No new issue will be created (I think this is what you want, right?).

For part 2, use the Create Issue action.

For part 3, start with a Branch / Related Issues component, configured with "Type of related issues" to contain your JQL. In that loop, use the "Link issues" action which allows you specify the "Most recently created issue".

Like # people like this
Jacob Rosenfeld September 9, 2021

Ok, this is what it looks like now and it's working. Thanks!

image.png

Like # people like this
TAGS
AUG Leaders

Atlassian Community Events