You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
INTRO
My brain feels like a jumbled mess now that I tried to do this, so I thought, I'll get some help!
CASE:
Our organization decided to limit the FixVersion/s field to only 1, and to make the field required... so I set out on that journey. I used the workflow transitions to check the number of FixVersion/s using a scripted validator, and I used the behavior's functionality to make it a required field, and so far that has worked.
PROBLEMS:
(1) People can still go to the edit screen, adjust the FixVersion count, and nothing will stop them from updating it because that logic only runs on a workflow transition.
(2) Issues that had multiple FixVersion/s before I made the changes above are still able to use the quick transition buttons move an issue through it's status, and nothing this behavior even though it's a required field, and there is a validator script.
(3) The server side validation for behaviors seems to be very limited as to what you can do with .getValue()... I'm not able to use .size() or .length() (that I know of) to check the number of FixVersion/s.
CODE:
I put some of the server side code I tried to write to run this check, but I don't think I made it very far.
def fixVersionsField = getFieldByName("fixVersions")
if (fixVersionsField.getValue() == null || fixVersionsField.getValue() == "" ){
fixVersionsField.setError("Version must be populated.")
} else if () {
// I deleted this, but thought someone here might be able to help me.
}
Hi @Benjamin Dains,
You can try out below code, I've added this to server-side script for fix versions field and tested with my sandbox
def fVersions = getFieldById("fixVersions")
def versions = fVersions.formValue as String
def vList = versions.split(',') as List
if(vList.size() > 1){
fVersions.setError("You should not select more than one fix version...!!")
}else{
fVersions.clearError()
}
Hope this helps
BR,
Leo
Hi Leo, thanks a bunch, sorry for the delay, I'll give it a go soon.
We have been really busy with a deploy that is going live tonight, so early next week I'll probably try this.
My biggest problem I had was trying to figure out how to get the fixVersion to count.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Leo I went ahead and tried it this morning since I already have a ScriptRunner behavior setup, and this worked perfectly. Thanks for the help!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.