Issue when trying to move to resolved status and the fix version is completed

Rosana Casilli November 13, 2018

Previously, I have an issue when trying to move to resolved status and the fixed versión was not set, it should show a message asking to complete fix versión.

 

Now, I am trying the other way around: having the fixed versión complete and trying to move to resolve status. 

It is supposed that I shouldn't have any issues, but when I click on Resolve button it shows me the following message:

An unknown exception occured executing Validator com.atlassian.jira.workflow.SkippableValidator@17eedcdc: root cause: java.lang.NullPointerException

 

The code that I have in the Validator in the transition is:

 

import java.util.Collection;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.project.version.Version;
import com.opensymphony.workflow.InvalidInputException;

//Collect<Version> fixVersions = $issue.getFixVersions();

if (! $issue.fixVersions) {
   throw new InvalidInputException("Fix Version/s is required");
}

 

What am I doing wrong? why is it showing that message? could you please help me?

 

Thanks in advance

Ro

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Cristian Rosas [Tecnofor]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 14, 2018

It should be enough adding this in a simple validator:

issue.getFixVersions() 

And then select the field fix versions to show the error you want there.

Rosana Casilli November 14, 2018

Hi Cristian!

 

I have written the exact what you told me, but now it doesn't show me the message error when the fix version is not complete.

 

I fogot to tell you that I am using Groovy

Cristian Rosas [Tecnofor]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 14, 2018

Are you using a simple validator or a scripted validator? Note that this are not the same. In Simple validator you don't need to use

throw new InvalidInputException("Fix Version/s is required");

But you ned to use it in a scripted validator

Rosana Casilli November 14, 2018

I am using Scripted Validator.

Cristian Rosas [Tecnofor]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 14, 2018

If you are using scripted validator use this:

import com.opensymphony.workflow.InvalidInputException

if (issue.getFixVersions()) {

throw new InvalidInputException("Fix Version/s is required");

}

If you are using Simple Validator, this should be enough:

issue.getFixVersions()

Rosana Casilli November 14, 2018

I do not have Script Runner installed (the company doesn't want to invest money on this) so I have installed Code Runner  Groovy, and I have written the code in my first post. But As I have said, when the fix version has a value then it shows the error "An unknown exception occured executing Validator com.atlassian.jira.workflow.SkippableValidator@17eedcdc: root cause: java.lang.NullPointerException"

Rosana Casilli November 15, 2018

I do not have Script Runner installed (the company doesn't want to invest money on this) so I have installed Code Runner  Groovy, and I have written the code in my first post. But As I have said, when the fix version has a value then it shows the error "An unknown exception occured executing Validator com.atlassian.jira.workflow.SkippableValidator@17eedcdc: root cause: java.lang.NullPointerException"

TAGS
AUG Leaders

Atlassian Community Events