Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Validate several different values within the same field (Story Points) on CREATION of an issue

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! 

2 answers

1 accepted

2 votes
Answer accepted

@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)$/

Validator 13 .PNG

Hope this screenshot helps you. 

0 votes

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)

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Events near you