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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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?

7 answers

10 votes
Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 27, 2020

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 

Like Steve Hess likes this
Deleted user Oct 14, 2020

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

  

Like Steve Hess likes this

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.

@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

Hey guys,

To increment a custom field. This is what I did and it seems to be working properly.

In the example below, I'm incrementing the rejection count by 1 each time the ticket is rejected. Hope this helps!

Screenshot 2021-11-10 at 1.57.30 PM.png

Like Neil Williamson likes this

Working for me. Thanks.

Hi

 

You don't need to re-fetch or use advanced editing, you just need to use the math calculation smart value which is {{#=}}{{/}} then in between stick your calculation using the field smart value with the calculation you want to do, in this case, +1.

 

{{#=}}{{Initial Size}}+1{{/}} but the {{#=}} is more for advanced math instead of a simple increment.

 

It also works with

 

{{#increment}}{{Initial Size}}{{/}}

 

It also supports using a different number {{#increment}}{{Initial Size}}+2{{/}}

 

Here's an extreme example

large increase.PNG

large increase history.PNG

I ended up using the Advanced field editing to get this to work:

 

{
"update": {
"customfield_10039": [{
"set": {{#increment}}{{issue.customfield_10039}}{{/}}
}]
}
}Screen Shot 2021-11-10 at 2.04.29 PM.png

Hello Sunny

Can you please help in advanced field setting, mine requirement 

We have field called ID, which should automatically update with number we create issue in specific issue type.

For example if we create bug issue type ID field should update with 1 and if we create again it should come as 2, it should be unique each time issue type bug is created. Can we acheive this.

Thank you

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!

Hi, I just finalized troubleshooting this with a support agent.
It actually will not work as stated for me with {{ #increment }}{{ issue.customfield_10063 }}{{ / }}

My result with this was that my numeric field was set to 1 after 1st trigger but then it was stuck there - not updated on subsequent triggers. 


I had to set with a +1 increment for it to work on subsequent triggers and for my value to increment to 2,3,4 etc.

{{ #increment }}{{ issue.customfield_10063 }}+1{{ / }}

Screen Shot 2021-11-10 at 2.06.10 PM.pngI ended up using the Advanced field editing to get this to work:

 

{
"update": {
"customfield_10039": [{
"set": {{#increment}}{{issue.customfield_10039}}{{/}}
}]
}
}

You can also decrement the field using the advanced field editingScreen Shot 2021-11-10 at 2.10.31 PM.png

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.  

This. Because transition in issue doesn't refresh the whole page, you won't see it increment before your very eyes without a refresh. I also noticed a very short delay, maybe 30s at most.

The top solution with {{#increment}}{{issue.myCustomFieldName}}{{/}} is working consistently for me.

Suggest an answer

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

Atlassian Community Events