In my project AB i have two issuetypes
- issuetypeA
- issuetypeB
also i have losts of components
- "component name for A part 1"
- "component name for A part 2"
- "component name for A part 3"
- "component name for A part 4"
- "company B part 1"
- "company B part 2"
- "company B part 3"
- "company B part 4"
So the problem is to write correct validator for such rule:
with issuetypeA can be used only components which starts from or containce component name ("component name for A part 1" for example)
import com.atlassian.jira.component.ComponentAccessor;
if(issue.projectObject.name == 'AB' && issue.issueType.name == 'issuetypeA')
def components = issue.getComponentObjects();
if (components != null && "component".equals(components[0].getName()) {
return true;
}
return false;
But its fail
Jira v7.5.0 and Adaptavist ScriptRunner for JIRA 5.2.2