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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

ScriptRunner: issue with Transition parent when all sub-tasks resolved

Hi everyone.

We have scriptrunner and use its post-function named "Transition parent when all sub-tasks are resolved".

The final status after parent's transition is not a final status in the workflow, meaning we don't need to set the resolution on the parent. Or, to be more precise, we need to leave it unresolved.

However, when I use the aforementioned post-function (I only choose the necessary transition, without setting any conditions, and leave the "Resolution" field value None) I get this error and it doesn't allow me to update the function.

What could be the problem with that?

Thanks in advance!

resolution not set error.png

2 answers

Is the "None" the correct resolution? Maybe try to pick "Unresolved" from the list?

resolution values.png
Unfortunately, there's no Unresolved in there

I think somebody designed it that way. Maybe try workaround? Add another status matching the state if the parent: "Subtasks done", or simply add "Unresolved", but this may cause some confusion when trying to search using JQL, as there will be two of the same resolutions.

Well, actually nope, because it was working fine previously. I don't even know when it started showing this error, to be honest.

Well, adding another resolution seems a bit worrying for me, since there're a lot of filters used in jira for this purpose, and basically Unresolved means that resolution is not set for the issue.

So if I set the Resolution to this new "Unresolved" I am afraid that it might cause side-effects.

The most important question is why is this now not working though it used to work in the past.

Hope to get some response from Adaptivist ScriptRunner members.

Anyway, thanks for your help!

You should also check the project settings to see, if "Resolution" field is required. Maybe it's blocking you there.

0 votes
Leonard Chew Community Leader Dec 05, 2019

Resolution "None" should be correct in my opinion, but if you are forced to set a value on that screen, this might be a workaround:

  1. select any other resolution for the postfunction to work
  2. add a "clear resolution" with a postfunction on the transition of the parent
    clearResolution.png

Alternatively:

  • Try a custom script on your postfunction and script the transition without setting the resolution.
Leonard Chew Community Leader Dec 05, 2019

Before trying the above... check if you have configured a transition screen with a mandatory resolution field.

Yes, I thought about that too.

I am afraid this might cause side-effects too. For example, if you're using some filter to find issues resolved in the last week, this workaround might cause the issue to appear in that search because the resolution for that issue was set during last week.

Thought I haven't tried this yet.

No, the transition 81 for the parent uses no screen.

Something new about that? I have the same error. I've updated the Script Runner version in our test enviroment and have the same results.

Thanks,

Roberto Bittencourt

Still doesn't work.
I've had to write my own script for this transition.
Perhaps you may find it useful.

import com.atlassian.jira.workflow.*
import com.atlassian.jira.util.JiraUtils
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor

def wtu = (WorkflowTransitionUtil) JiraUtils.loadComponent(WorkflowTransitionUtilImpl.class)

def userKey = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser().getKey()

def parent = issue.getParentObject()
def subtasks = parent.getSubTaskObjects()
def categories = subtasks*.status.statusCategory

if (parent.getStatus().getSimpleStatus().getName() == "In Progress" &&
    categories.every {cat -> cat.getName() == "Complete"}) {

       def mp = parent as MutableIssue

       wtu.setIssue(mp)
       wtu.setUserkey(userKey)
       wtu.setAction(81)

       if (wtu.validate()) {
            wtu.progress()
       }
}

This is the script which transitions parent issue from status "In Progress" through the transition with id 81 when the status category for all sub-tasks is "Complete", i.e. work finished.
Of course you need to adjust it a little bit based on your needs.

Suggest an answer

Log in or Sign up to answer
TAGS

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