Hi,
I want to set a field hidden based on another custom field using behaviour. But the hidden field is not showing up when i select Yes. Please see code:
//defining variable to get custom fields
def testscript_field = getFieldByName ("Tests Scripts / Test Results successful (Yes/No)")
def Signoff_path_field = getFieldByName ("Specify Test Scripts/UAT Signoff path")
//Retrieving the current field value as a String
def script_value = testscript_field.getValue() as String
def isOtherSelected = script_value
if(testscript_field == "Yes")
{
Signoff_path_field.setHidden(false)
}
else
{
Signoff_path_field.setHidden(true)
//Signoff_path_field.setRequired(true)
}
Thanks
Swarna
Hello,
Could you add logging to your code and have a look in the atlassian-jira.log file for your logging output?
//defining variable to get custom fields
def testscript_field = getFieldByName ("Tests Scripts / Test Results successful (Yes/No)")
def Signoff_path_field = getFieldByName ("Specify Test Scripts/UAT Signoff path")
//Retrieving the current field value as a String
def script_value = testscript_field.getValue() as String
def isOtherSelected = script_value
log.error("isOtherSelected: " +isOtherSelected )
log.error("Signoff_path_field: " + Signoff_path_field)
if(isOtherSelected == "Yes")
{
Signoff_path_field.setHidden(false)
}
else
{
Signoff_path_field.setHidden(true)
//Signoff_path_field.setRequired(true)
}
HI,
Try the below code in behaviour, if the finCF field is select list customfield:
def finCF= getFieldByName ("Tests Scripts / Test Results successful (Yes/No)")
def appCF = getFieldByName ("Specify Test Scripts/UAT Signoff path")
appCf.setHidden(true)
appCf.setRequired(false)
if (finCf.getValue() == "Yes")
{
appCf.setHidden(false)
appCf.setRequired(true)
}
else //Change Type is set to Normal
{
appCf.setRequired(false)
appCf.setHidden(true)
}
Hope this will help you.
~Tushar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the If-else loop just you have been used testscript_field, but you are not fetching values.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Yogesh,
I have updated the script but still the another field is not showing up
//defining variable to get custom fields
def testscript_field = getFieldByName ("Tests Scripts / Test Results successful (Yes/No)")
def Signoff_path_field = getFieldByName ("Specify Test Scripts/UAT Signoff path")
//Retrieving the current field value as a String
def script_value = testscript_field.getValue() as String
def isOtherSelected = script_value
if(isOtherSelected == "Yes")
{
Signoff_path_field.setHidden(false)
}
else
{
Signoff_path_field.setHidden(true)
//Signoff_path_field.setRequired(true)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.