The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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 Champions.
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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

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 Champions.
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)
}

TAGS
AUG Leaders

Atlassian Community Events