Forums

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

Post Function to Auto Increment Custom Field on Jira Cloud on specific transition (not just status)

Kevin Christmann May 1, 2023

I need to increment a custom field by 1 on a post function. It is seemingly a simple ask, but I have some nuance that I cannot find an answer for.

I'm really struggling to figure out how to achieve this. I've read a dozen or so questions\replies related to this but none of them are exactly what I need. My assumption is that I need to use Scriptrunner to do this.

  • I use Jira cloud (other scripts I am seeing are for Server)
  • I need to do this on one specific transition. Note: this is not entering a specific status, but on a specific transition. I have more than one transition exiting and entering the exact same statuses, which is why I need this to be a post function and not automation. See screenshot below.
    2023-05-01_16-58-38.png
  • I was wondering if instead of Scriptruner, I can use the "Update Issue Custom Field" post function but it is not clear to me if I can make that value dynamic or if it is a static value.

1 answer

1 vote
Fabian Lim
Community Champion
May 1, 2023

Hi @Kevin Christmann

You can try using Jira Automation and add 1 to it everytime the transition is executed: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/

Regards,

Fabian

Kevin Christmann May 2, 2023

@Fabian Lim  I don't think that works though because automation won't let me get as specific as I need. As I mentioned (and seen in screenshot) I have 2 transitions that both have the same starting and ending status. Automation does not let you specify a transition. It only lets you specify starting and ending status. (Unless I am overlooking something.)

Kevin Christmann May 2, 2023

Unless I am overlooking something, automation can only specify the from and to status. That doesn't work for me because I have 2 distinct transitions with the same "from" and "to". I need my automation to only apply to 1 of those. Which is why I think it needs to be a post function on the specific transition.

 

2023-05-02_08-42-37.png

Karolina Dylewicz October 26, 2023

Hey @Kevin Christmann , you know how I did it:

on the transition where you want things to happen, I added a simple post-function to mark a custom field type select with just some value. I know this field doesn't change in any other situation. 

Then, in the automation, I could use a trigger: when the field value changes to X, run through the action... :) and it works. Like this the system knows exactly when to do it :) 

Suggest an answer

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

Atlassian Community Events