I need to set epic link using groovy if a condition is true. I'm using the following script:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.issue.Issue; def customFieldManager = ComponentAccessor.getCustomFieldManager() IssueManager issueManager = ComponentAccessor.getOSGiComponentInstanceOfType(IssueManager.class) def epiclink = CustomFieldManager.getCustomFieldObject("customfield_10101") issue.setCustomFieldValue(epiclink,"TS-14")
If I set the epic link to null it works,
I believe you will need to pass the issue object of the Epic in order to link it, not the Epic link's issue key.
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issueManager = ComponentAccessor.getIssueManager()
def epicIssue = issueManager.getIssueObject("TS-14") // Epic issue key here
def epicLink = customFieldManager.getCustomFieldObjectByName("Epic Link")
epicLink.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(epicLink), epicIssue),new DefaultIssueChangeHolder())
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
Trello is one of the most effective tools for driving your sprints. It's customizable for every Agile team and product owners and Scrum masters (SM) love it. However, Agile teams often struggle with:...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs