Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Validator condition if Insight custom filed value is in particular Object type

Hi!

I have several Object Types in my Insight with different Objects in them, e.g.:

Servers

 - server1

 - server2 etc

Switches

 - switch1

 - 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

1 answer

1 accepted

1 vote
Answer accepted

Hi Andrey,

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")[0].objectTypeId == 23

where 23 is the object type ID. Unfortunately, I'm unable to test this right now, but you get the idea.

Yeah, after some more deep investigations i have also found the proper code, but you have shown me the way, thanks!

 

issue.get("customfield_10501")?.first()?.objectTypeId == 38

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
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