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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,458,291
Community Members
 
Community Events
176
Community Groups

How can I transition an issue state only after two custom fields have been updated?

Edited

I have an issue I'm trying to transition when a custom date, and custom hash field are updated, but only if another field is in the approved state. This last one is a button transition back to the current state (done by someone and would be a lot of work to change). So I'm trying to just leave it alone.

 

So, what I'm trying to do now is use a listener to only transition the issue to the next state in the workflow external review if both variables have been updated and are not set to empty. However, I can only get it to work for a single custom field update. Any ideas on how I could make this listener depend on both being changed?

 

I tried to detect a change in both fields in the same listener script and only transition if both are changed, but that doesn't seem to work (maybe it's not timed right).

 

Any idea on how to handle a two field update transition? I haven't run across any questions that could help me solve this. I'm using Jira 8 by the way, and scriptrunner.

1 answer

0 votes

Here is how I would rephrase your rule... does that seem correct?

When

  • either field A or field B is changed

If

  • both fields contain a value

Then

  • trigger the transition

Or is it important that both fields have just been changed either together via the edit screen or in short succession (perhaps within the last x minutes) via in-line edits?

In the case of screen edit, I think both fields should be in the event.changeLog. But for in-line edits, you would get 2 separate events. So then you need to only fire on the second event, and only if the other field was also recently changed. You'll have to decide what the appropriate time threshold is. And then call the changeHistoryManager to get all the recent changes to see if the other field was also modified.

It's important for both of the fields to have changed. I was going to try your idea of using a time threshold but I couldn't figure out how to get the number of minutes since a change was made to the field. I also wasn't sure how to trigger the listener to fire the right event to play off of the other field to make this work. Currently, I just have the one listener, and I'm not able to detect changes except right when they happen. So, I'm not sure how to handle a change that happened, say 2-3 minutes ago, which would be a reasonable time to allow the ticket transition.

 

Ideally what I want to do is have it auto-transition in whatever order I do it in. So whether the approvals come first, or whether the fields are changed and then the approval transition occurs.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events