Hi ,
I am using JIRA python to update to issue link(duplicate link) for JIRA id and it works fine.
Now i want to remove those issue link from that JIRA id
Any Idea pls
I am able to do in using below code
#getting issue links
#create JIRA instance
self.jira = JIRA(basic_auth=(self.jira_username, self.jira_api_token), options={"server": self.jira_server})
#Pass JIRA name and get Issue links
idl=self.jira.issue(jiraid) # passing JIRA name
getIssuelinks=idl.fields.issuelinks #issuelinks
#iterate and delete
for x in getIssuelinks:
print(x.id)
self.jira.delete_issue_link(x.id)
Could you clarify :
idl=self.jira.issue(jiraid) # passing JIRA name
getIssuelinks=idl.fields.issuelinks #issuelinks
Since id1 is a dictionary this does not work,
I should be doing something wrong.
My Code:
from atlassian import Jira
import json
jira = Jira(
url='https://aa.bb.com/',
token='someToken')
issueData = jira.issue("BBBB-1000")
json_formated= json.dumps(issueData, indent=1)
getIssuelinks=issueData.fields.issuelinks #issuelinks
print(json_formated)
Error:
Traceback (most recent call last):
File "C:\Data\repositories\jira_python\jira\jira_test.py", line 9, in <module>
getIssuelinks=issueData.fields.issuelinks #issuelinks
^^^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'fields'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's a bit late, but as the above helped me, here is my code to remove all links within an Epic.
epicKey = input("Enter the Epic key")
jqlStr = f'issueFunction in issuesInEpics("key = {epicKey}") OR (type = Epic AND key = {epicKey})'
fields = ['key', 'issuelinks']
issues = jira.search_issues(jql_str=jqlStr, fields=fields, maxResults=1000)
for issue in issues:
links = getattr(issue.fields, 'issuelinks', [])
for link in links:
try:
jira.delete_issue_link(str(link.id))
print(f"inwardIssue link {link.id} deleted")
except Exception as e:
print(f'Failure removing links using delete_issue_link: {e}')
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.