Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Show/Hide Fields on ITSM Request screen?

Wesley Stewart October 8, 2021

I am having trouble wrapping my head around this.  The ITSM Request screen is made BEFORE an issue exists.  So I think when I am calling field values, they are always showing as null.  Is this even possible?

I have tried many different things.  But currently I am trying to make a behavior and this is more or less what I am trying.  If I run this as an initializer, it ALWAYS hides the Description field.  I believe this is because the getFieldByID doesnt exist yet on the ITSM request screen?

(Sorry for the lack of a code block, not sure how to do that here)

def selectListField = getFieldById("Exception Template")
def selectListValue = selectListField.value
def textField = getFieldByName("Description")

if (selectListValue == null) {
textField.setHidden(true)
} else {
textField.setHidden(false)
}

Hoping someone can help guide me!

1 answer

Suggest an answer

Log in or Sign up to answer
1 vote
Wesley Stewart October 8, 2021

Figured it out! I needed the customfield nameID, not it's full name.  This has some parts added as I changed the functionality from show/head to readonly true/false

 

def selectListField = getFieldById("customfield_12900")
def selectListValue = selectListField.value
def textField = getFieldByName("Description")
def text = "PreMade Text"
if (selectListValue == "Specific Selector Text Here") {
textField.setFormValue(text)
textField.setReadOnly(true)
} else {
textField.setHidden(false)
textField.setReadOnly(false)
textField.setFormValue(" ")
}

TAGS
AUG Leaders

Atlassian Community Events