Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

In Select List(Single Choice) customfield selecting an Option text field should pop-up.

Kumar
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.
October 17, 2018

Hi Team,

I have field called "Source" select list (single choice) type custom field

in that i have added options A,B,C,D&Other.

Now when i select the option D and Other . A text field has to view on create and edit screen when i select the A,B,C that text field suppose to hide

Select List(Single Choice) custom-field ID-10012

Text Field Custom-field Id-10026

could you explain me  guys step by step  how can I achieve this .

 

Thanks,

Phani

1 comment

Kumar
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.
October 18, 2018

Hi All ,

 

I have Resolved this issue my self by using script runner plugin  Behavior  

here is the thing what to do admin settings----->Add-ons--->Behaviors---->Add a Behavior give an name----->Click On Fields--> in that select workflow of project in "Guide workflow" option------>In a fields tab "Add Field"  Select List custom field------>after that click on "Add server-side script".   here is the script that you have to use 

def otherFaveField = getFieldByName("Name Of TextField") //Give a text field custom field name that you have created 
def faveFruitField = getFieldById(getFieldChanged())

def selectedOption = faveFruitField.getValue() as String
def isOtherSelected = (selectedOption == "Other" || selectedOption == "D") //instead of Other/D You can give another option that you want

otherFaveField.setHidden(! isOtherSelected)
otherFaveField.setRequired(isOtherSelected)

 

and then Save it ---->go back to Behaviors--->you will see "Add Mapping" on the side of "Fields" ------>click it and map to "Choose projects(required)" and "Choose issue type" click on Add Mapping

thats it its all got to go

 

when creating/Editing an ticket in the project while creating when you choosing the Select List custom field selecting the "Other"  option it will automatically display the Text Field that you have created and if select another option it wont display the text field

 

Thanks,

Phani

Kumar
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.
October 22, 2018

Hi All,

Here is another script this one when you edit the ticket and change the option the text field gonna be empty and disappear

example: the above script when you select the option "D" or "Other" a text field should be appear will enter the text and we created ticket 

after creating ticket if you want to edit the selected list filed with another options like "A or B or C" the above  script still shows the text field that you have entered while you selected option "D" or "Other".

So now with this new script when you edit the selected list filed with options like "A or B or C" the text field also disappears 

 

//customfield_12003 - Data Change Exception
//customfield_12004 - Other Description
if(getFieldById("customfield_12003").getValue().equals("D")
|| getFieldById("customfield_12003").getValue().equals("Other")){
getFieldById("customfield_12004").setHidden(false)
getFieldById("customfield_12004").setRequired(true)
}else{
getFieldById("customfield_12004").setFormValue(null)
getFieldById("customfield_12004").setRequired(false)
getFieldById("customfield_12004").setHidden(true)

} 


 I hope it helps sombody

 

Thanks,

Phani

Like Michiel Schuijer likes this
Michiel Schuijer July 20, 2022

Thanks. This helped me more than the script example from ScriptRunner!

Comment

Log in or Sign up to comment
AUG Leaders

Atlassian Community Events