JQL syntax for Automation - increment current numeric value everytime a new issue is linked

Hajnal Daniel
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 22, 2024

I have a custom numeric field called Reports Count which I want to automatically increment by 1 every time I link a new ticket to it with the relationship similar to. 

I previously used lookup for this and worked well, by counting every time the total nr of tickets linked. This solution no longer works for me due to 2 reasons:

  1. I want to be able to also manually adjust the number in Reports Count and the current implementation ovewrites,
  2. I might have more than 100 issues linked to a certain ticket, whereas lookup will not work over 100

I tried several solutions online and can't make it work:

{{issue.Reports Count}} + 1

{{#increment}}{{issue.Reports Count}}{{\}}

1 answer

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.
April 22, 2024

Hi @Hajnal Daniel -- Welcome to the Atlassian Community!

For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected.  Those will provide context for the community to offer ideas.  Thanks!

Until we see those...

For your first specific question about manually overriding the calculated count, the approach depends on how your rule works.  Seeing the rule may reveal how to do this, such as using an additional field / indicator to prevent the update.

Regarding counting more than 100 issues, that is easier to solve...

  • instead of using Lookup Issues with JQL to find the issues, call the REST API issue search with JQL using the Send Web Request action
  • the response will return, at most, 100 issues, but it will also contain the total count of matching issues
  • use that total count to update your field

If you want to try that approach, here is a how-to article for calling a REST API function from a rule and the reference for the function needed:

https://community.atlassian.com/t5/Jira-Software-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-get

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events