I have written a behaviour that has a few fields hidden, but when a certain option is chosen in another field, those fields are shown. How to I also write in to hide/show the Attachment field (While in create or edit mode)? I have written what I though would work, but it is not hiding it. Please see my script:
{code}
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
def customFieldManager = ComponentAccessor.customFieldManager
def optionsManager = ComponentAccessor.optionsManager
def campusTypeField = getFieldById("customfield_14126")
def learningObjField = getFieldById("customfield_16338")
def existingHCField = getFieldById("customfield_20091")
def attachWordField = getFieldById("customfield_20092")
def otherSupportField = getFieldById("customfield_20093")
def requestField = getFieldById("customfield_20094")
def releaseDateField = getFieldById("customfield_20095")
def earlyPublishField = getFieldById("customfield_20096")
def presentationAttachment = getFieldByName("Attachment")
if (campusTypeField.getValue() == "Help Center Article")
{
learningObjField.setHidden(false)
existingHCField.setHidden(false)
otherSupportField.setHidden(false)
requestField.setHidden(false)
releaseDateField.setHidden(false)
earlyPublishField.setHidden(false)
presentationAttachment.setHidden(false)
}
else
{
learningObjField.setHidden(true)
existingHCField.setHidden(true)
otherSupportField.setHidden(true)
requestField.setHidden(true)
releaseDateField.setHidden(true)
earlyPublishField.setHidden(true)
presentationAttachment.setHidden(true)
}
{code}
Hi
I have fixed this issue.
We can't use system field byname, we can use system field by ID only
Attachment id is "attachment".
def Attachment = getFieldById("attachment")
Thanks
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.