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

Custom field value validation

Hello Team,

I have two custom fields, the second field should pop up in create issue only if the value in first custom field matches certain text.

Is it possible to configure something like that ? Do suggest if anyone has done something like that.

1 answer

1 accepted

0 votes
Answer accepted
Antoine Berry Community Leader Jan 30, 2020

Hi @vishal ,

This is possible using an addon. I would advise ScriptRunner through its behaviours module. It is a very complete addon with great support. I can help with the code if needed.

Antoine

Hello Antoine,

That would be great help, I am trying it with behaviour only but couldn't get it done. If you can help with the code would be fantastic.

 

Vishal

Antoine Berry Community Leader Jan 30, 2020

Create a new behaviour and link it to the first field. Add a custom code : 

import groovy.transform.BaseScript
import com.onresolve.jira.groovy.user.FieldBehaviours

@BaseScript FieldBehaviours fieldBehaviours

int secondFieldId = 12800
def secondField = getFieldById("customfield_" + secondFieldId)
secondField.setHidden(true)

//if underlyingIssue does not exist, it means we are in the issue creation
if (!underlyingIssue){
int firstFieldId = 12900
def firstField = getFieldById("customfield_" + firstFieldId)
def firstFieldValue = firstField.getValue()

if (firstFieldValue.contains("123")){
secondField.setHidden(false)
}
}

You have to adapt it with your field ids and requirements. Let me know if you need something more specific. Note that this code will only trigger when the focus is lost on the first field.

Like vishal likes this

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