How to get a parent task ID of a sub-task using python library ?

Amr Farid November 19, 2017

How to get a parent task ID of a sub-task using python  library   ? 

3 answers

1 accepted

3 votes
Answer accepted
Matt Doar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 9, 2018

The info is in issue.fields.parent in issues of type sub-issue, such as Sub-task

 jql = "project = MYPROJ and type = Sub-task"
issues = jira.search_issues(jql)
log.info("Found first %s subtasks" % len(issues))
for issue in issues:
print "Parent %s of subtask %s" % (issue.fields.parent, issue.key)
1 vote
Daniel Balogh March 7, 2019

Not sure it helps:

in the instance I'm working on it is the field:

"issue.fields.customfield_13272"

I don't now, whether this is a reserved field by atlassian, or it's a matter of implementation.

I took an Issue I knew it's a Sub-Task an knew its parent key. Made a rest-call in Browser and searched for the key in the resulting json :)

BR,

Daniel

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 19, 2017

Try the issue.getParent call.

Amr Farid November 21, 2017

It doesn't work, The object has no attribute called getParent, Does it work with certain version of Jira library or do you the api call ? 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 21, 2017

It's the API call - I'd expect any python library to expose it, as it's pretty fundamental.

Himanshu_Pant April 4, 2018

Guys,

Did you get any way to achieve this ? or anyone can give a suggestion on this ?

Amr Farid April 5, 2018

I didn't manage to get from python Jira library. I've used native REST call. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events