I have several Object Types in my Insight with different Objects in them, e.g.:
- server2 etc
- switch2 etc
And i have an Insight custom field in each issue, where you should choose an Object linked to it.
So i want to implement a Validator, that certain field was required, but ONLY if an Object in my custom filed was in particular Object type.
For example, text field "VLAN" should be required only if Object chosen was in Object type "Switches"
So i choose a Validator in workflow, choose "Fields Required Validator (JMWE app)" and say that "VLAN" field should be required on this transition. And check 'conditional validation' checkbox. System offers me to type a Groove expression for the condition. I tried
issue.get("customfield_10501") in iqlFunction("objecttype = \"Switches\"")
like i do in JQL, but that doesnt work. Please advice
we do have in our backlog JQL-based Conditions and Validators, but this will only work if the JQL "filter" depends only on values before the transition screen. Because JQL uses the Jira index, which is not updated with values entered on the transition screen. So in your case it would never work, since you're testing two fields that are being modified on the transition screen.
However, you can implement the conditional validation in Groovy, although Insight's Java API doesn't make it particularly easy.
issue.get("customfield_10501").objectTypeId == 23
where 23 is the object type ID. Unfortunately, I'm unable to test this right now, but you get the idea.
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