On my issue screen creation, when I click on the create button, transition Create is run.
I would like to specify some rules in the validator's part of this transition.
In my case, I have :
- a listbox (called Type) where I must choose between the following values : Project, GPA, Versioning Service, DBA
- a listbox (called Project) containing a list of available projects
- a textbox (called RP Code)
I would like to control the following :
If Type.value="Project" then
If we choose the others values of Project listbox (GPA, Versioning Service or DBA), listbox Project is not mandatory as textbox RP Code.
I think I will have to use cfValues['Project'], cfValues['RP Code'] and cfValues['Type'], but I don't know how.
Thanks a lot.
The condition should be something like:
cfValues['Type'].value != 'Project' || (cfValues['RP Code'] && cfValues['Project'])
ie, either the type is not project, or both other fields must have values. Test in Admin -> Built-in Scripts -> Condition Tester.
If you have configurable options for a custom field cfValues contains an Option object where you have to use getValue() to get the actual string value of the selected option. So cfValues['Type'].value should get you the text of the selected option.
Did you try the first and second part of the condition separatly in the condition tester mentioned by Jamie?
Hi Jamie et all,
I was wondering if there was anything special that needs to be done to view the values on the Create Issue screen inside of a Groovy validator. I have tried the above stated "cfValues" array, but I don't see anything in the validator code. This problem only happens when creating a non-subtask issue (story/bug/epic).
Any thoughts would be appreciated.
After trying to create a new big of sample code to demonstrate the problem to you, it seemed to wanted to work. I've tested it locally on my JIRA environment as well as on our Dev/Test environments so the code works great.
Some code to add in the validator of the create transition that might help others debug which is a combination of the above suggestions.
def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction")
log.debug "IssueKey : " + issue.getKey()
log.debug "Issue : " + issue
log.debug "Description : " + issue.getDescription()
log.debug "Summary : " + issue.getSummary()
log.debug "CustomValsArray: " + cfValues
log.debug "*** END ***"
Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot