Increment a Scripted Field Edited

I'm wanting to increment the value of a custom field by one as a post function in a workflow. I was initially thinking of creating a Scripted Field custom field type and incrementing that way but it doesn't look like there's a way to retain that field's value (i.e. it has to be calculated using other fields in real-time).

I was then thinking of using a "Text Field (read only)" and using a Groovy script in the post function to increment. But because that's text, I'm assuming there's no way to numerically evaluate that in a JQL (e.g. give me all issues where that value > 3).

Is there anything else I can do? I basically want the equivilent of the read only text field but have it be a read only number field.

2 answers

You've worked your way through all the clever ways you might do this, but missed one possible approach!

Use a normal number field.  Have a script that updates it.  Do not put the field on any screen other than "view", so the only way to update it is with your script.

Doh! Of course! Thanks Nic!

0 vote
Steven Behnke Community Champion Aug 17, 2017

Agreed with Nic. It's likely easier to just +1 a normal number field.

As a scripted field I'd probably walk the workflow history and look at how many times an action was taken.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

176 views 0 4
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you