Forums

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

Can I input a JQL query into an automated comment?

Alexander Steel September 19, 2024

I am attempting to make a simple automated message when a ticket is triaged in Jira Servicedesk.

I want the message to say something like

"Hi {{issue.reporter.displayName}},

Your issue has been read over and assigned a priority of {{issue.priority.name}}.

We currently have X outstanding tickets of that priority or higher and are already working on Y of them.

We will pick your issue up as soon as we have cleared these tickets ahead of you in the queue.

Regards, the support team"

 

I can get JQL queries for the X and Y values fairly easily but can't find a way to enter it into the automated email.

 

Has anyone come across a way to do something similar?

3 answers

1 accepted

5 votes
Answer accepted
Semih Tolga Yazici
Contributor
September 19, 2024

Hey Alexander,

I will share with you a simple example to guide the solution that you can implement.

X (All tickets that are not done) -> {{issue.priority.name}} AND statusCategory != Done
Y (In Progress) -> {{issue.priority.name}} AND status = 'In Progress'

Create an Automation.
Select the trigger according to when you want to calculate the number of issues and send an email.
Use branch rule (you can select current issue)
LookupIssues action.
And provide the JQL in there for X and Y.
{{lookupIssues.size}} smart value will give you the number of issues.
And you can add one more action which is Send email and use that smart value. Or you can put it into a customfield.

However, there might be a total limit for the JQL that gets the issues.

In that case, let's say the limit is 100.

You can say in the email like there are more than 100 issues that are in the queue currently.


The other but not the best way is counting the issues in a customfield. It will decrease the number -1 whenever and issue goes to the statusCategory = Done. It will increase the number whenever an issue is created.

Alexander Steel September 19, 2024

I did see some similar comments but jira isn't happy with the {{lookupissues.size}} and is simply skipping over it.
Is there some specific licence or versioning that is required?

image.pngimage.png

Alexander Steel September 19, 2024

Strangely after trying again it worked, no change to any of the queries but it just seemed to work all of a sudden and since I have been able to test and it is working fine.

Thank you

Like Mark Higgins likes this
Alexander Steel September 19, 2024

The final section that allowed for the emailimage.pngimage.png

Like Mark Higgins likes this
1 vote
Semih Tolga Yazici
Contributor
September 20, 2024

I have just tried for you {{lookupIssues.size}} yeah it still works fine and it gave the result actually. 

 


image.png

Mark Higgins
Community Champion
September 22, 2024

Hi,

Yes, it now works for me as well? Weird.

I did add a log action inbetween but all is now good.

Screenshot 2024-09-23 084708.png

 

Email looks like:

Screenshot 2024-09-23 084708.png

 

Thanks @Alexander Steel that is a very useful idea.

Mark

1 vote
Mark Higgins
Community Champion
September 19, 2024

Hi @Alexander Steel 

I was curious to see if this did work in my environment and it did not.

What did work (and I admit it's not ideal) is this:

{{#lookupIssues}}

* {{key}}

{{/}}

which lists ALL the issues that the JQL returned.

Try as I might, I can not get the .size to work??

 

Mark

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events