Hi all,
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.
Thank you!
@Marcus Lyne you can use Scripted Regex validator in Workflow. For this you have to put below code :-
cfValues['Field Name'] ==~ /^(2|4|5|6|10|18)$/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
return false
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)
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.