Unlink issues from Epic

Hello :)

I need some help with unlinking issues: 

Current code i have is:

 

import com.atlassian.jira.config.properties.PropertiesManager
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.UpdateIssueRequest
import com.atlassian.jira.ComponentManager
import org.apache.log4j.Category
import com.atlassian.jira.issue.link.IssueLink;
import com.atlassian.jira.ManagerFactory
import com.atlassian.jira.issue.link.IssueLinkImpl

MutableIssue issue = ComponentAccessor.getIssueManager().getIssueObject('CB-7493')

def issueLinkManager = ComponentAccessor.getIssueLinkManager();

def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

issueLinkManager.removeIssueLink(issue, user.name);


Many thanks!

Pon

1 answer

1 accepted

Hello Pon.

May I suggest that you do a thorough search in the community before asking? It is highly likely that other users have already asked the same question.  

Also, in this question you are not really saying if the script fails or not, or if it doesn't work, or if it gives out an exception of some sort. 

Here you have a question about how to delete the link between a parent and a child issue

Also, from where I can see at your code, removeIssueLink takes an Issue and an ApplicationUser. In the last line of your script:

issueLinkManager.removeIssueLink(issue, user.name);

You are passing "user.name", which is a String. You should change the line to 

issueLinkManager.removeIssueLink(issue, user);

 Hope this helps!.

Cheers

DYelamos

Thank you so much!@!!!

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

77 views 0 5
Read article

Atlassian User Groups

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!

Find my local user group

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

Groups near you