Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Increment Custom Field on Transition

Edited

Hello :)

I'm trying to automatically increment a counter when a card issue passes through a specific transition.

After my QA team testing procedure, the issue can pass through "test rejected" transition and i would like to count every time it happens for the same issue (Counting rework).I think about a custom field counting it.

Does anyone have some suggestion dealing with this without plugins (or using only automation for JIRA)? Maybe a different approach?

3 answers

5 votes

Hello @lucas_almeida

Thank you for reaching out.

Per your description, I understand you would like to increment a custom field by 1 every time you transition your issue to a specific status. Is that correct?

You can definitely create a custom number field and use an automation rule to properly increment the field when a specific transition occurs. These would be the steps:

  1. Create a number custom field and add to your issues. P.S: In my own site that I will use as an example, I named it as "increment".
  2. Navigate to your project > Project settings > Automation and create the following rule, using the Smart value "{{#increment}}{{issue.yourcustomfield}}{{/}}" to increment the field value and selecting the status you want it to be updated:
    Screen Shot 2020-05-27 at 17.20.43.png

For more details about the instruction provided and how to handle numerical values with Jira automation, check the documentation below:

Use smart values to insert numerical values 

Let us know if this information helps.

hi. i've been set the smart value. 

on the first time, the field successfully updated (from 0 to 1).  but for the second time so on, it failed to increment the value (value still 1). 

can you help me ?

Screenshot from 2020-09-01 16-55-30.pngScreenshot from 2020-09-01 16-54-39.pnghere the audit log

Screenshot from 2020-09-01 17-04-33.png

Were you able to solve this? I'm having the exact same issue, works only the first time 

Humn!!! I'm also having same issue... Help appreciated

  

If it helps, I created a new custom field with a different name and it worked fine... I couldn't figure out why it didn't work for the old one. 

I had a typo in the field name in issue.yourcustomfield. After correcting, it started to increase the number nicely.

I've tried using the custom field id found using the api as well as the custom field name I gave it. It still won't increment past 1. Has anyone else had this problem?

 

@julie naglestad 

Can you share a snip of the automation rule details to help us try and troubleshoot?

Obviously maybe grey out or hide anything that might be sensitive!

Thanks

Lewis

For anyone else that has the issue of only incrementing to 1 and not beyond.

 

I'd originally gone with the name of the field in the automation e.g. DaysInCurrentStatus for the field "Days In Current Status". Switching this to use the customfieldID resolved the problem.

E.G:

{{#increment}}{{issue.customfield_11566}}{{/}}

Issue details are viewable via a link like below:

https://[YOURINSTANCEDETAILS].atlassian.net/rest/api/2/issue/[YOURISSUEKEY]

I'm unable to get my field to increment even to 1. Call me stupid, but can you give an example of what exactly you put in [YOURINSTANCEDETAILS] and [YOURISSUEKEY]?

Cool this actually worked. Small change I did was use this link -> https://[YOURINSTANCE].jira.com/rest/api/2/field to get my custom ID

@A D Sugar ,

Apologies I did write a response to this but my browser clearly decided no!

Your instance details will be visible in the URL when you are on any Jira page. If you worked at ACME for example it would be:

https://acme.atlassian.net

Issue key is just the Jira number reference for one of your issues that you want to view the underlying details (such as the custom field ID for your custom field you want to increment. So if you have a project for "Road Runner Traps" you might see an issue id:

RRT-50

Hopefully that all makes sense and gives you a couple of more tools to aid in automating processes in Jira.

Thanks

Lewis

Like A D Sugar likes this

Thank you, Lewis. That is very helpful!

For those who hit a problem, I solved it by re-fetching the issue data. Believe the rule repeatedly adds to the original value thus does not adds the second time. Hopes this helps someone.  

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Apps & Integrations

🍂📹 Apptoberfest demo contest roundup: vote for your favorite demos!

Hi Community! The submissions are in (and listed below) for the 🍻🍂Apptoberfest🍂🍻 Demo Competition and it’s time for you to place your votes for the best: Analytics & reporting app demo ...

252 views 6 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you