During creation of a bug issue, I need a validator to check whether the affected version field is empty or not?
So I want to prevent the creation of the issue, when no affected version was inserted.
How can I do this with script runner?
Community moderators have prevented the ability to post new answers.
Hi JIRA Admin,
This requirement can be achieved using a simple Scripted Validator placed on the create transition which uses the code and configuration shown below.
Code:
issue.getAffectedVersions().size() >=1
Configuration:
image2016-2-25 14:42:39.png
Example output:
image2016-2-25 14:43:8.png
I hope this helps.
Thanks
Kristian
This works, however, is there a way to mark the field with a little asterisk?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In order to show the asterisk you would need to mark the field as required in the field configuration scheme like Nic suggested below.
Thanks
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi JIRA Admin,
If this answer was useful can you please mark it as accepted so it is easy to find for other users with a similar question.
Many Thanks
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use this:
import com.atlassian.jira.issue.Issue import com.opensymphony.workflow.InvalidInputException Issue myIssue = issue if (! myIssue.getAffectedVersions().size()) { invalidInputException = new InvalidInputException("versions", "Affects Version/s is required in this context.") }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This doesnt work for me. I could create the issue.
I also get an error message from script runnter: "the variable invalidInputException is undeclared"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Or just make it mandatory in the field ocnfiguration
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried this first, but for unknown reason it didn't worked for me.
I just marked the field as required. Should I need to enable something else too?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nope. If you have marked it required in the field configuration correctly (I usually manage to do it in the wrong field configuration), then you'll get the mandatory star next to the field on create and won't be able to complete without selecting a version.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.