Forums

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

Looking for Way to Limit Story Points to a value between 1 - 99

Brian Taylor
Contributor
March 9, 2018

We are looking for a way to limit the input of the Story Points field to be > 0 but less than 99 so that if a person fat fingers a value we do not have a LARGE number in point history

 

I tried creating a behavior but did not work 

 

def cs = getFieldByName("Story Points")
if (cs.getValue().toString().length() > 99) {
cs.setError("Story Point > 99")
cs.setRequired(true)
} else {
cs.setError("")
cs.setRequired(false)
}

1 answer

1 vote
Alexey Matveev
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.
March 9, 2018

Your code must be like this

def cs = getFieldByName("Story Points")
if (Integer.valueOf(cs.getValue().toString()) > 99) {
cs.setError("Story Point > 99")
cs.setRequired(true)
} else {
cs.clearError()
cs.setRequired(false)
}

You should add the Story Points field to your behaviour and set the script for the field.

Brian Taylor
Contributor
March 12, 2018

Question - noticed with the behavior that in the Edit Detail screen or clocking the field to change the value - it now bring up the edit screen and lose the ability to just edit the field. 

Alexey Matveev
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.
March 12, 2018

Behaviour do work like this. If you click on a filed in the view issue screen then the edit issue screen will be opened. You can read about it here

https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html#_screens

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events