You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hi Team,
I want hide a text field depending on the value of select list field. written a below script but not getting expected output.
Can you please check and let me know where I am wrong:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
def textField = getFieldById("customfield_22695")
def selectList = getFieldById("customfield_22694")
def selectListValue = selectList.getValue()
if (selectListValue == "None")
{
textField.setHidden(true)
}
else
{
textField.setHidden(false)
}
Hi
NONE is not an actual value for the select list. It's only a place holder when no values are selected.
So you can do a simple groovy truthy check like this:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
def textField = getFieldById("customfield_22695")
def selectList = getFieldById("customfield_22694")
def selectListValue = selectList.value
if (selectListValue){
textField.setHidden(true)
} else {
textField.setHidden(false)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Peter,
If I want to modify my script to hide the field for the options called None and No.
The field should be visible for the value Yes, Can you check my below script is ok or need some modification:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
def textField = getFieldById("customfield_22695")
def selectList = getFieldById("customfield_22694")
def selectListValue = selectList.value
if (selectListValue == "None" || selectListValue == "No")
{
textField.setHidden(true)
}
else
{
textField.setHidden(false)
}
The above script is working for Yes and No value,, but not for None, kindly suggest teh correction.
Regards,
Neeta Jain
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One of these should work:
if (!selectListValue || selectListValue == "No")
if (selectListValue == '' || selectListValue == "No")
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.
Happy New Year! We hope you all had a safe and restful holiday season. 2020 was a unique year full of unforeseen events; however, as we enter the new year of 2021, we’re optimistic for the light at t...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.