Forums

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

Behaviour to hide field values based on other field values being selected

Rob B
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.
July 29, 2020

Hi, is it possible to certain hide 'field 2' values based on what value is selected in 'field 1' using behaviours? 

Im new to script runner.

Thanks

Rob

1 answer

1 vote
Subrat Mishra
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.
July 29, 2020
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField


FormField CF1 = getFieldById(getFieldChanged())

if ( CF1.getValue().equals("the value you want") ) {

getFieldById("customfield_1234").setHidden(true)

}
else {

getFieldById("customfield_1234").setHidden(false)

}

Attach this behaviour to the field based on which value you need to make the other field hidden . Replace customfield_1234 with your actual custom field ID ( that needs to be hidden)

Rob B
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.
July 30, 2020

Hi, 

Thanks for your help, but i need to hide values of another field rather than the whole field. Is that possible?

IF CF_1 = '123'

THEN CF_2 contains only half the values (eg '1','4','6')

Subrat Mishra
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.
July 30, 2020
Rob B
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.
July 30, 2020

Thanks Subrat ill give it a go! Thanks :)

Subrat Mishra
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.
July 30, 2020

Yes, you need to get the option hiding code from the other script and put it together in above behaviour to make it work .

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.0
TAGS
AUG Leaders

Atlassian Community Events