Hello,
I have a select list field that I want to hide unless another text field has a value.
I'm trying to implement the solution posted at https://community.atlassian.com/t5/Jira-Core-questions/Condition-on-a-custom-field-basis-for-triggering-behaviour/qaq-p/850186
My code for the behaviour is:
def amountToBePaidToOther = getFieldByName("Amount to be paid to Other")
def ftr = getFieldById("FTR/NPR Justification")
log.debug("Amount to be paid to Other value" + amountToBePaidToOther.getValue())
if (amountToBePaidToOther.getValue() == null) {
ftr.setHidden(true);
} else {
ftr.setHidden(false);
}
I've tried configuring the script to both fields.
When I view the customer portal, the select list field is still visible with no value in the text field.
Thank you.
Instead of null, I used "" and the Behaviour works.
def amountToBePaidToOther = getFieldByName("Amount to be paid to Other")
def ftr = getFieldById("FTR/NPR Justification")
log.debug("Amount to be paid to Other value" + amountToBePaidToOther.getValue())
if (amountToBePaidToOther.getValue() == "") {
ftr.setHidden(true);
} else {
ftr.setHidden(false);
}
hi. Change this line: def ftr = getFieldById("FTR/NPR Justification")
on
def ftr = getFieldByName("FTR/NPR Justification")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Roman. The FTR field still does not react to the behaviour, but thank you for catching that error.
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.