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

How may I increment a custom field's number on a specific transition?

Each time the transition "blah" is used I want to increment a custom field by 1. If the field's value is empty, it should become 1. If the field's value is 3 it should become 4.

The transition "blah" transitions issues to a status used by all issues, so basing the rule off the status is not possible. Each time the transition "blah" is used the issue has the resolution set to "blah" and then cleared using post-functions. This is a poor effort at keeping track of when the transition "blah" was used. The "blah" transition only exists once in-between two status' on my workflow.

The only add-on I have installed on my cloud instance of Jira is Automation for Jira and I'd like to keep it that way. Thanks in advance for your help.

2 answers

1 accepted

2 votes
Answer accepted
Nick Menere Community Leader Mar 05, 2018

Hi Ryan,

 

You can definitely do this. To do this set up a rule to listen for an issue transition, add a Jql condition to check status of the issue (status = blah) and then add an Edit issue action.

Select the field you want (My Customfield) to increment and use the following value:

{{#increment}}{{issue.My Customfield}}{{/}}

This will increase the value every time the issue goes into that status.

 

Let us know if you have any specific problems with it or if I mis-understood the use-case.

 

Cheers,

Nick

This worked flawlessly, Nick! You're a gentleman and a scholar. Thank you.

Nick Menere Community Leader Mar 09, 2018

Glad to have helped!

Hi there!

Tried to replicate on a number field, but got some problems:

 

Whenever I try to paste some part of the script it gives me an "invalid number" error.

Since it's my first time scripting in automation, I did some trouble shooting and it gives me the same error even with 

{{issue.My Customfield}}

or  

{{#increment}}4{{/}}


I'm quite puzzled because I don't have any actual idea about what is going on :(

Tiziano 

Nick Menere Community Leader Dec 12, 2018

Hi Tiziano,

Are you able to provide a screenshot of your rule and esp. the configuration for this field.

 

Cheers,

Nick

Hi Nick,

I am embarassed to say that after a good head scratching I have come to the solution and I am sorry to have bothered the community: Automation for Jira it's not the same as Jira's Automation :)

I filed a request to our purchasing to get the plugin asap.

Thank you for your quick response,
Tiziano

Like Jenifer Kuntz likes this

I am unable to get this to work.  I copied the script changed it to my field and I get, "Unable to update custom field"

Nick Menere Community Leader Sep 16, 2019

Hey Jared,

Can you share a screenshot of your rule config and the resulting Audit Log.

 

Cheers,

Nick

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

5 mobile apps for Jira Cloud to boost productivity

  It’s very important to have access to the workflow process from anywhere. Especially if you manage the work of others. There is no difference whether you’re out of office, or drive a ca...

240 views 2 5
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