Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Behaviour script to make the tab non mandatory

Hi Team,

I am struggling to find a behaviour script in adaptavist scriptrunner and other sources. Kindly help me the similar script

 

I need a script like if I choose a particular value in a field then the mandatory tab (which is already existed ) has to be non mandatory.

2 answers

1 accepted

3 votes
Answer accepted

A tab cannot be made required or not required.

You can only hide/show a tab.

You will have to make all the fields in the tab required or not one by one.

Hi Peter

Still I am not able to sort out. could you provide a script on behaviours

If I select "Business services"(value)

in "Business Driver" (Elements connect field) 

then other fields "ID Impact, Product Impact, PD Houses" to non mandatory.

Assuming the fields is not flagged as required (all fields must be set to optional) in the project's field configuration a script like this should work:

def busDriverFld = getFieldByName('Business Driver')
def tabFieldNames = ['ID Impact', 'Product Impact', 'PD Houses']

def requiredBySelection = busDriverFld.value != 'Business services'

tabFieldNames .each{fieldName->
getFieldByName(fieldName).setRequired(requiredBySelection)
}

 Be sure to confirm the spelling of all field names and values (including correct case).

0 votes

Tabs do not have an optional/mandatory setting, but they look like they do when they contain a mandatory field.

Behaviours can not make a field optional if it is set mandatory in Jira - the mandatory setting is checked on the server-side as the issue is created, and Behaviours can't get to that.

So, to make a tab "optional", you have to make all the fields within it optional in the field configuration.

You can use Behaviours to completely hide a tab, but you'll need to have all the fields on it optional.

Thanks Nic

could you provide a script on 

If I select "Business services"(value)

in "Business Driver" (Elements connect field) 

then other fields "ID Impact, Product Impact, PD Houses" to non mandatory.

Again, you cannot make a field non-mandatory with Behaviours.  You have to make the field optional in the field configuration.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Do you use Jira Cloud with Microsoft Teams?

Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...

463 views 3 7
Read article

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