I`m trying to hide field based on custom field in Jira script runner behaviour cloud when selected value is no or null. fields are still showing up when value is null.
const triggerField = getFieldById('customfield_11609');
const ticketCategoryField = getFieldById('customfield_11610');
const lineManagerField = getFieldById('customfield_11611');
const triggerFieldValue = triggerField.getValue().value
switch (triggerFieldValue) {
case 'Yes':
lineManagerField.setVisible(true);
ticketCategoryField.setVisible(true);
break;
case 'No':
ticketCategoryField.setVisible(false);
lineManagerField.setVisible(false);
break;
}
Could you please clarify what type of fields are: customfield_11609, customfield_11610, and customfield_11611?
I am asking this because ScriptRunner for Jira Cloud is unlike DC. At the moment, only certain types of fields can be used for Behaviour.
I am looking forward to your feedback and clarification.
Thank you and Kind regards,
Ram
The reason Ram is asking this is because the comparison may not be valid, depending on the field type. Some fields may show you "Yes" and "No" on screen, but the actual value (from triggerField.getValue().value ) may not be "Yes" or "No"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello.
triggerField (customfield_11609) is single select list with Yes/No dropdown. If triggered field value is null or No then conditional fields will be hidden and if yes then conditional fields will be visible. I believe this is working now. so when no value selected or No selected, fields are hidden.
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.