make field required only in one tab

hi,
I have a transition screen with 3 tabs. And wont to make comment field required only in one tab, in another it must be hiden. Can i make this with baheviour plugin?

2 answers

1 accepted

1 vote
Accepted answer
Alexey Matveev Community Champion Jan 18, 2018

I do not hink it is possible. Actually there is only 1 comment field and it is not linked to any tab. You can see it in the html code. That is why you should link behaviour to tabs and if a tab is activated you should hide or show the comment field depending on your logic. But it is not possible to link behaviour to a tab. 

thanks for your answer, but how I can chek which tab is activated?

Alexey Matveev Community Champion Jan 18, 2018

You can not do it with behaviours. You could do it with JavaScript but I would not do it.

one more question, can i set field as required based on selected value of another field? all fields are on transition screen

Alexey Matveev Community Champion Jan 18, 2018

Yes, you can do it. You need to add the field, which value influences the other field, to the behavour and put your logic in the script for the field

def problemField = getFieldByName("Field with value").getValue()
def sum = getFieldByName("first field to require")
def link = getFieldByName("second field to require")
if(problemField == "a" || problemField == "b" ){
sum.setRequired(true)
}else if(problemField =="c"){
sum.setRequired(true)
link.setRequired(true)
}

 I try to do it with this code. It works. But it does not make field required based on current walue. I must to perform transition(or save data to the field with value) and then, during next transition it will be required. But i wont to chang this in current time, not only after save.

def problemField = getFieldByName("Field with value").getValue()
def sum = getFieldByName("required field a")
def link = getFieldByName("required field b ")
if(problemField == "a" || problemField == "b" ){
sum.setRequired(true)
}else if(problemField =="c){
sum.setRequired(true)
link.setRequired(true)
}
i try to do it with this code. It works, but it make field required not in current time. I must to perform a transition, and then in next transition screen it will by OK. I wont to dynamicly change required or not. How i can do it?

Alexey Matveev Community Champion Jan 18, 2018

You need to add the problemField to the behavour (add field) and set the script for the field. In this case the script will fire all the time the problemField changes.

okey, thanks, now i try to make required field "Linked Issues" with this behaviour, but it dont works. 

1 vote
Joe Pitt Community Champion Jan 18, 2018

Tabs are just a logical separation of a screen. To JIRA it is one screen so if the plugin can do it with a screen it should be able to do it with the tabs

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 16, 2018 in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

1,325 views 17 10
Join discussion

Atlassian User Groups

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!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you