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

Show/Hide Custom text field based on Insight Object custom field selected value.

Sam Bartolome
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.
December 18, 2020

Hi,

I would like to know if there is the possibilit to show/hide a custom field depending on the selection of an Insight Object.

I have used the below code which it meant to work for 2 custom fields but it doesn't apply with an Insight Object

def resolutionField = getFieldById("customfield_11122")
def fixVersionsField = getFieldById("customfield_11127")

if ("customfield_11122" == "Order (ITSM-19529)") {
fixVersionsField.setRequired(true)
fixVersionsField.setHidden(false)
}
else {
fixVersionsField.setRequired(false)
fixVersionsField.setHidden(true)
}

 

Any help will be appreciated.

Thanks

1 answer

1 accepted

1 vote
Answer accepted
Sam Bartolome
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.
January 13, 2021

Finally I've managed to get it working.

It seems the selectable option from the Insight Object should be only the number and not the name neither the name and number altogether. And probably to convert the option to String too

 

def resolutionField = getFieldByName('resolution')
def fixVersionsField = getFieldByName('fixVersions ')
fixVersionsField.setHidden(true)
def resolutionOption = resolutionField.getValue()

if (resolutionOption.toString() == 'ITSM-19529') {
fixVersionsField.setRequired(true)
fixVersionsField.setHidden(false)
} else {
fixVersionsField.setRequired(false)
fixVersionsField.setHidden(true)
}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events