Hi,
After searching around this site and Google and refering to the Script Runner confluence page I just can't get my validator script to work and need some help.
I am trying to implement a simple validator script that will check the following for the issue being transitioned:
1) there must be at least 1 linked issue with a name of Test
2) assuming statement 1 above is true then all linked issues with a name of Test must be in a specific status
The code I have so far is:
import com.atlassian.jira.ComponentManager
import org.apache.log4j.Category
import com.atlassian.jira.issue.link.IssueLink;
import com.opensymphony.workflow.InvalidInputException
log = Category.getInstance("com.onresolve.jira.groovy.LinkedIssues")
testlinkType = ["Test"]
linkMgr = ComponentManager.getInstance().getIssueLinkManager()
// We are looking for the Inward Link of "Is Tested By"
for (IssueLink link in linkMgr.getInwardLinks(issue.id)) {
if ((testlinkType.contains(link.issueLinkType.name)))
{
if (!link.getSourceObject().getStatusObject() == "Template") {
invalidInputException = new InvalidInputException("Linked issue " + link.getId() + " is not in a status of Template")
}
}
}
Any help would be greatly appreciated.
Thanks.