I am an administrator and have had a request come in asking for me to limit the values that can be selected for the 'Story Points' field. This is a request for one project though, so I cannot edit the field as this would affect all projects using the field. I am a 'Level 1' and therefore have very limited experience with scripting. After reviewing the validators, I am under the impression that the best way for me to achieve this is through the 'Script Validator [ScriptRunner]' and then via the 'Simple Scripted Validator' option. The issue I am having is I can't quite figure out the actual script to use. The options I need available are as follows: 0, 1, 3, 5, 8, 13 and 20.
The version of Jira I am using is: Jira Software 8.5.8
Would anybody be able to give me a hand with this? Would be hugely appreciated.
Yep, this script is quite short and is probably the most common use case (checking a custom field value, not your specific case)
def customFieldName = "Story Points"
def customField = ComponentAccessor.customFieldManager.getCustomFieldObjects(issue).findByName(customFieldName)
assert customField: "Could not find custom field with name $customFieldName"
def value = issue.getCustomFieldValue(customField)
if (value == 1 || value == 3 ...) return true
But, I think I'd want to be a bit sneakier - rather than clobber the user and return then to their transition screen to re-enter it, maybe automate a correction. You could add a listener that does something like "If SP = 2 then set it to 3, if 4 or 6, set to 5, if 7-11 set it to 8, if 12-19, use 13, and if over 19, set it to 20". Oh, and round it too, in case someone is completely missing the point of planning poker and taking a mean average of the cards shown in a hand.
I'd use a listener to do this because you can have those work on issue edits as well as transition (validators only check on transition, there's nothing that would stop someone editing an issue and changing the points to a hundred, twelvety or any other number)
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