Forums

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

Automation rule for checking if issue request type has been created within a yearly timeframe

Matt S January 6, 2025

Hi all,

I'm new to Jira and have been looking at automation rules for some of the issues I am having. I would love some help on the logic for an automation rule to check:

- if a reporter submits a particular issue type request:

- check if they have made the same type of request within the last year (or a set date range)

       - if yes, send an email saying exceeded amount of requests allowed and close issue

       - if not, create the issue as normal.

Any guidance would be appreciated,

Thanks

2 answers

0 votes
Matt S January 6, 2025

It is a request type and its for a service management project.

0 votes
Trudy Claspill
Community Champion
January 6, 2025

Hello @Matt S 

Welcome to the Atlassian community.

Have you tried to create this automation rule? If so, please share with us what you have so far an on what part you are stuck.

The basic structure would be:

Screenshot 2025-01-06 at 5.31.17 PM.png

 

The trigger for the rule is Issue Created.

1. Next add a condition to check the type of the created issue. I am unclear if you want this to be based on Issue Type or Request Type. Request Type is an attribute specific to Service Management projects.

2. Use a Lookup Issues action to execute a JQL to see if there are any issues of that same type by the same reporter created within the past 365 days.

3. Add a condition to check the size of the results set from that action to see if it is greater than 1. There should be at least 1 issue in the results set because of the issue just created.

4. If the result set is greater than 1 then transition the current issue to the desired status.

5. And send an email to the reporter.

 

Matt S January 6, 2025

It is a request type and its for a service management project.

Trudy Claspill
Community Champion
January 6, 2025

The structure I presented should work. You will have to modify the places where I used issue type to reference request type instead.

Like Bill Sheboy likes this
Matt S January 7, 2025

Ive created the rule and it seems to run when I create some issues, however nothing happens when I create more than 2. The issue type is actually a customer request type with a particular name for some staff uniforms. Would {{issue.Customer Request Type}} be applicable in the rule?

Trudy Claspill
Community Champion
January 7, 2025

Have you examined the Audit Log for the rule? If you are using the Issue Created trigger the rule should be triggered each time an issue is created in the project. The Audit log will have an entry for each time the rule is triggered. If you expand that it will have information about that specific execution of the rule, including the issue that triggered the rule.

Can you find the entry for the second issue you created, where you think nothing happened? Perhaps there was something about that second issue that doesn't match the conditions in your rule.

Please provide the following information:

1. A screen image that shows your entire rule.

2. Screen images showing the details of each step in the rule.

3. A screen image from the Audit Log showing the details of the execution for that second issue you created, where you think nothing happened.

Matt S January 7, 2025

Ive attached some screenshots, Im certain the code for the request type is wrong. The rule is getting errors I have attached the audit log pictures as well.

image.pngimage.png

Trudy Claspill
Community Champion
January 7, 2025

Well, the first thing I note from your screen images is that the graphics indicate you are using Jira Data Center (or Server) rather than Jira Cloud (which is in your post tags).

What version of Jira are you using? Click on the question mark button in the upper right near your avatar, select About, and let us know what version information is shown.

Did you try to build up the query in the Issue Search screen first? I always try to do that to make sure I have the syntax correct. You can't use the smart values in the Search screen, but you can substitute in real values there to validate that your JQL is otherwise correct.

The first problem I believe you will find is that since your request type name is multiple words with spaces in it, you'll need to enclose that in quotes.

 

I think you will also have a problem with the smart value being used for Reporter. The accountId attribute is not used in Jira Server/Data Center. It is only used in Jira Cloud. In a Jira Server/Data Center environment you would instead just use

{{issue.reporter}}

 

Here is a link to the documentation for Automation for Jira for Jira Data Center:

https://confluence.atlassian.com/automation/jira-data-center-automation-993924595.html

Like Matt S likes this

Suggest an answer

Log in or Sign up to answer