Within the Script Listener or Post Function, we're referencing an issue's linked issues as MutableIssues and attempting to set the property (Summary and FixVersions) of those issues with the setSummary and setFixVersions methods. The end result is that the values are not changed. We are able to set the values of the originating event.issue or issue, but none of the linked issues properties. Example code below:
JIRA: 7.0.5
ScriptRunner: 4.2.0.5
// Determine if this is an Epic, if so, return the Epic Link name
if (issue.getIssueType().name == "Epic") {
// Variables for the issue itself
IssueLinkTypeManager issueLinkTypeManager = ComponentAccessor.getComponent(IssueLinkTypeManager)
IssueLinkManager issueLinkManager = ComponentAccessor.issueLinkManager
Collection<IssueLinkType> storyLinkTypes = issueLinkTypeManager.getIssueLinkTypesByName('Epic-Story Link')
Long storyLinkTypeId = storyLinkTypes[0].id
// Defining Link Manager
def optionsManager = ComponentAccessor.getOptionsManager()
def issueManager = ComponentAccessor.getIssueManager()
def fixVersion = issue.getFixVersions()
// If the link type is Epic-Story Link
if (storyLinkTypes) {
// Iterating through all Links pertaining to Epic
for (IssueLink link in issueLinkManager.getOutwardLinks(issue.id)) {
// Checking the Epic-Story Link
if (storyLinkTypeId == link.issueLinkType.id)
{
def linkedIssueStatus = link.destinationObject.getStatus().getName()
MutableIssue linkedIssue = issueManager.getIssueObject(link.destinationObject.getId())
linkedIssue.setSummary("New Summary")
}
}
}
}