Forums

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

Smart values for a custom field needs to return -Issue count + Current year

Shriram Someshwar March 26, 2024

Greetings!

I have a field which needs to get updated when a new task is created.

The format of the string inside the field needs to be  "YYYY-xxxx" Here YYYY is the current year and XXXX is the total issue count created for that year.(the counter needs to reset we hit a new year)

I have set up a rule to trigger this automation when an issue gets created, I'm having trouble with getting the exact smart values that I need to write

Any help or direction is greatly appreciated!!

1 answer

0 votes
Kalyan Sattaluri
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.
March 26, 2024

Hello @Shriram Someshwar 

Can you share how are you getting the total issue count currently or is that the ask?

If thats the ask, to get this value, you can make a REST call using your JQL to below end point and it will give the total issues you can access using {{webhookResponse.body.total}}

 

sample end point: https://yourdomain,net/rest/api/2/search?jql=*yourJQL*

sample response:

{
    "expand": "schema,names",
    "startAt": 0,
    "maxResults": 50,
    "total": 6,
    "issues": [
        {  ....  } ]}
If you can make this call and log/capture this data, your final format is easy.
A little overview on how to make REST call:
  • Write your JQL in normal Jira UI.
Lets say it is: project = ABCD and created >=2024-01-01
  • Then you form the endpoint url using above reference:
  • Copy paste that in your browser and hit enter, it will return response and browser would have formatted the URL (replacing spaces with %20) which you can use in your rule.
After your trigger
New Action -> Send web request, use end point as above with formatted JQL.
Authentication -> Follow the steps here to supply basic auth headers for this call
Log {{webhookResponse.body.total}}
Shriram Someshwar May 23, 2024

Hey, - Thank you for your inputs. I'll try and get back to you 

Currently this ask for a specific standalone project - so I guess I would using the Project Key to filter issues out

Like Kalyan Sattaluri likes this

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