Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Bhargavsai
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 19, 2021

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

1 vote
Answer accepted
Vishwas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 20, 2021

Hi @Bhargavsai 

What is the exact use case here :)

Regards,

Vishwas

Vishwas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 20, 2021

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
Bhargavsai
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 20, 2021

Hi @Vishwas 

Thankyou.

Like Vishwas likes this

Suggest an answer

Log in or Sign up to answer