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

Is there a way that if the value is ticked the text field will show using Behavior Plugin

Ysaac James Salao June 22, 2018

Hello Atlassian,

Is there a way that if the "Other" value is ticked the text field will show,  instead of the below code as it is just reading what is the specific value of the selectedOption. 

The reason for this is sometimes the Impact can have 2 values (e.g Customer and Other)

Custom Field Name: Impact

Field Type: Checkbox

Options:

  • Customer
  • Client
  • Other

Custom Field Name: If Others, please specify

Field Type: Text (Multi-line)

 

Currently, this is my code and it is working perfectly.

 

import com.atlassian.jira.component.ComponentAccessor

def impact = getFieldById("customfield_23845")
def others = getFieldById("customfield_23644")
def selectedOption = impact.getValue() as String

if (selectedOption == "Others")
others.setHidden(false)

else if ((selectedOption == "Others" && "Automation/Cost saving (Efficiency)"))
others.setHidden(false)

else {
if(others.value)
{
others.setFormValue(null)
}
others.setHidden(true)
}

 

Thank you!

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events