Hi there,
I am building up a JIRA - support project for different Atlassian Tools (JIRA, Confluence, HipChat). Depending on the selected component (either JIRA, Confluence or HipChat), different customfields shall be either "visible & required" or "invisible & optional" in the create process.
Case 1 - Initial situation:
- Field "Business Unit" = Hidden
- Field "JIRA Project Concerned" = Hidden
Case 2 - Component "JIRA" being selected:
- Field "JIRA Project Concerned" = Visible and mandatory
Case 3 - Component "Confluence" being selected:
- Field "Business Unit" = Visible and mandatory
Case 4 - Component "HipChat" being selected:
_Shall be handled as case 1_ (both fields invisible and optional)
In my opinion this is a standard case for the behaviours plugin, but after several hours and a lot of code changes, I ended up with following code, which simply does not work for us:
import com.atlassian.jira.bc.project.component.ProjectComponent
FormField components = getFieldByName ("Component/s") // id for Component
FormField BusinessUnit = getFieldById ("customfield_10572") // id for "Business Unit"
FormField JiraProjectConcerned = getFieldById ("customfield_10100") // id for "Jira Project concerned""
String component = components.getValue()
if (component == 17850) {
JiraProjectConcerned.setHidden(false)
}
else {
JiraProjectConcerned.setHidden(true)
}
Furthermore I optionally tried using following code in the initialiser script:
BusinessUnit.setHidden(true)
BusinessUnit.setRequired(false)
JiraProjectConcerned.setHidden(true)
JiraProjectConcerned.setRequired(false)
The result of the first snipplet is always that field "JIRA Project concerned" is hidden and will never show up, so the else-case seems to always true.
As mentioned it took me already a lot of time, being non code-savvy, so I'd be more than grateful to have any concrete hints into the right direction.
Thanks and best regards
Kai
PS: Already had an intense look into the documentation of the plugin at Adaptavist and in following questions here: