You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Is it possible to update AffectedVersions from Theme to Epic when Epic get linked to Theme? Bellow is script that I came up with for that, but update is not happening.
Could you please take a quick look if that will work for the purpose?Thank you
import com.atlassian.jira.ComponentManagerimport com.atlassian.jira.issue.CustomFieldManagerimport com.atlassian.jira.issue.customfields.CustomFieldTypeimport com.atlassian.jira.issue.fields.CustomFieldimport org.apache.log4j.Categoryimport com.atlassian.jira.component.ComponentAccessor;import com.atlassian.jira.issue.ModifiedValue;import com.atlassian.jira.issue.fields.layout.field.FieldLayoutItemImpl;import com.atlassian.jira.issue.util.DefaultIssueChangeHolder;import com.atlassian.jira.util.ImportUtils;import com.atlassian.jira.project.version.VersionManager;import com.atlassian.jira.issue.index.IssueIndexingService;import com.atlassian.jira.event.type.EventDispatchOptionimport com.atlassian.jira.issue.link.IssueLink;import com.atlassian.jira.issue.link.IssueLinkManager;import com.atlassian.jira.issue.Issue;import com.atlassian.jira.issue.MutableIssue;import com.atlassian.jira.issue.link.IssueLink;import com.atlassian.jira.event.issue.IssueEvent;import com.atlassian.jira.component.ComponentAccessor;def issueLinkManager = ComponentAccessor.getIssueLinkManager()def epicissue = event.issue as MutableIssuedef issueManager = ComponentAccessor.getIssueManager();def versionManager = ComponentAccessor.getVersionManager();def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()if (epicissue.getIssueType().getName() == "Epic") issueLinkManager.getOutwardLinks(epicissue.id).each { issueLink -> if (issueLink.issueLinkType.name == "Theme" && issueLink.getDestinationObject().getIssueType().name == "Theme" ) { MutableIssue issue = issueLink.getDestinationObject() as MutableIssue; def currentValue = issue.getAffectedVersions() epicissue.setAffectedVersions(currentValue); issueManager.updateIssue(user, epicissue, EventDispatchOption.ISSUE_UPDATED, false) boolean wasIndexing = ImportUtils.isIndexIssues();IssueIndexingService indexing = (IssueIndexingService) ComponentAccessor.getComponent(IssueIndexingService.class)indexing.reIndex(issue)ImportUtils.setIndexIssues(wasIndexing) } }
Unfortunately, this is not possible in our Jira 7 by the means of ScriptRunner.
The "IssueLinkCreated" event was introduced only Jira 7.5. Will upgrade and then revisit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.