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

create 3 fields namely Activity types(single choice), Build Product(cascading), Build Project Code(c

Edited

For some values in Activity type field, other two fields(Build Product and Build Project Code) should be mandatory, What is the best script for executing this condition.

 

1 answer

1 accepted

0 votes
Answer accepted

Hi @Bhargavsai 

What is the exact use case here :)

Regards,

Vishwas

Hi @Bhargavsai 

You can write script in behavior something like this. Select "Activity Type" as field and in server side script add this script. You need to replace Custom field id of other 2 fields you have to set as mandatory.

def Cf1 = getFieldById(getFieldChanged()).getValue().toString() 
if ( Cf1 != null){
getFieldById("<Custom field id of Field 1>").setHidden(false);
getFieldById("<Custom field id of Field 1>").setRequired(true);

getFieldById("<Custom field id of Field 2>").setHidden(false);
getFieldById("<Custom field id of Field 2>").setRequired(true);

}
else{
getFieldById("<Custom field id of Field 1>").setHidden(true);
getFieldById("<Custom field id of Field 1>").setRequired(false);
getFieldById("<Custom field id of Field 1>").setFormValue("");

getFieldById("<Custom field id of Field 2>").setHidden(true);
getFieldById("<Custom field id of Field 2>").setRequired(false);
getFieldById("<Custom field id of Field 2>").setFormValue("");
}

 

Regards,

Vishwas

Like Bhargavsai likes this

Hi @Vishwas N M 

Thankyou.

Like Vishwas N M likes this

Suggest an answer

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

👋 Looking for 15-20 volunteers to test Atlassian training content

Hi everyone! Are you interested in beta testing Atlassian University’s newest (unreleased!) training course? We’re looking for 15-20 volunteers to test our newest training course, Basic reporting...

429 views 19 22
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