Hi,
I am working on a script which automatically sets and removes issue flags when blocking issue links are set. For me, the script looks good but I receive the following error message where the function/method call fails.
2018-07-19 10:36:08,685 INFO [runner.ScriptRunnerImpl]: EVENT: IssueLinkDeletedEvent
2018-07-19 10:36:08,803 ERROR [runner.AbstractScriptListener]: *************************************************************************************
2018-07-19 10:36:08,803 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.jira.event.issue.link.IssueLinkDeletedEvent, file: <inline script>
groovy.lang.MissingPropertyException: No such property: log for class: IssueModifier
at IssueModifier.isAssignedToAllowedTeam(Script1314.groovy:118)
at IssueModifier$isAssignedToAllowedTeam.call(Unknown Source)
at Script1314.run(Script1314.groovy:293)
The code of the script looks like this.
class IssueModifier
{
...
public Boolean isAssignedToAllowedTeam(Issue issue)
{
String teamName = issue.getCustomFieldValue(this.customFieldTeam).toString();
if (this.allowedTeams.contains(teamName))
{
log.info issue.getKey() + ': team "' + teamName + '" is allowed team.';
return true;
}
log.info issue.getKey() + ': team "' + teamName + '" is not set as allowed team.';
return false;
}
...
}
...
if (event instanceof IssueLinkDeletedEvent)
{
log.info 'EVENT: IssueLinkDeletedEvent';
def issueLinkDeletedEvent = event as IssueLinkDeletedEvent;
def issueLink = issueLinkDeletedEvent.getIssueLink();
def sourceIssue = issueLink.getSourceObject() as Issue;
if (issueModifier.isAssignedToAllowedTeam(sourceIssue) && issueModifier.isAllowedIssueType(sourceIssue) && issueModifier.isOutwardBlockingLink(issueLink))
{
def destinationIssue = issueLink.getDestinationObject() as MutableIssue;
if (
!issueModifier.isAllowedIssueType(destinationIssue) &&
!issueModifier.isAssignedToAllowedTeam(destinationIssue) &&
// issueModifier.assignedToSameTeam(sourceIssue, destinationIssue) && // commented out because we accept the case to unflag an issue of anouter allowed team
!issueModifier.isFlagged(destinationIssue)
)
{
issueModifier.unflag(destinationIssue, event.getUser());
}
}
}
Best regards
Boris