Show 2 Fields based on Another field

Ray Navarro
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!
March 27, 2023

Hi Experts,

 

I'm trying to show a custom field twice in a form. 

 

Custom field1 is "Entity" (single-choice)

Field2 is, "Is this for another Entity?" (single-choice)

Then show the "Entity" field again on the screen.

Is there a way to this?

 

I'm using scriptrunner but it only works for a single field. Can I set this up to show the same field until the reporter selects No?

 

def cfA = getFieldById("customfield_ID1") 
def cfB = getFieldById("customfield_ID2")
cfA.setHidden(false)

if (cfB.value == "No"){
cfA.setHidden(true)
cfA.setRequired(false)
}
else {
cfB.setHidden(false)
cfC.setRequired(true)
}

2 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
Oday Rafeh
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.
March 28, 2023

Hi @Ray Navarro , Welcome

You can try to add a third field called "Show Entity" which will be hidden or shown based on the value of the "Is this for another Entity? " field. If "Yes" is selected, the "Show Entity" field will be shown which is a duplicate of the "Entity" field. Otherwise, the "Show Entity" field will be hidden.

def cfEntity = getFieldByName("Entity")
def cfAnotherEntity = getFieldByName("Is this for another Entity?")
def cfShowEntity = getFieldByName("Show Entity")

cfEntity.setHidden(false)
cfAnotherEntity.setHidden(false)
cfShowEntity.setHidden(true)

if (cfAnotherEntity.getValue() == "Yes") {
cfShowEntity.setHidden(false)
} else {
cfShowEntity.setHidden(true)
}
Ray Navarro
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!
March 29, 2023

Thanks! It looks like we need to create a separate field. I found my way thru checkbox field. 

Like Oday Rafeh likes this
0 votes
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 28, 2023

Hi @Ray Navarro and welcome to the community,

No, it's not possible to show the same field twice on a screen. May I ask what is it you want to achieve by showing the same field twice?

TAGS
AUG Leaders

Atlassian Community Events