Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vikrantyadav11/4990bd16627696961670325c2a4db5ae to your computer and use it in GitHub Desktop.
Save vikrantyadav11/4990bd16627696961670325c2a4db5ae to your computer and use it in GitHub Desktop.
Show Hide Dropdown Field Based on Another Dropdown in Jira scriptrunner for Jira Cloud
// Get the field objects
const usesAI = getFieldById("customfield_28493");
const ai_feature_type = getFieldById("customfield_28494");
// Default state: hidden and not required
ai_feature_type.setRequired(false);
ai_feature_type.setVisible(false);
// Get the value of the "Uses AI" field
const usesAIValue = usesAI.getValue();
// ✅ Correct conditional check
if (usesAIValue && usesAIValue.value === "Yes") {
ai_feature_type.setRequired(true);
ai_feature_type.setVisible(true);
} else {
ai_feature_type.setRequired(false);
ai_feature_type.setVisible(false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment