Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

i am using jira cloud. I am trying to programatically create jira tasks and attach it to epic

Krishnadhas N K June 1, 2024

i am using jira cloud. I am trying to programatically create jira tasks and attach it to epic. i am using atlassian python sdk version 

3.41.13

I am able to create issues that i am successful but while trying to attach it to a epic, it fails


i used this function 

new_issue.update(fields={'parent': {'id': epic_key}})

referred Using Jira's Python API, how can I set the epic link for an issue? - Stack Overflow

Am i missing any settings?

2 answers

1 accepted

0 votes
Answer accepted
Krishnadhas N K June 14, 2024

i found the answer myself. this snippet can help you create a story and attach it  to a specific epic using python and atlassian Python sdk. 

def create_story_under_epic(epic_key, summary, description):
issue_dict = {
'project': {'key': 'DEVOPS'},
'summary': summary,
'description': description,
'issuetype': {'name': 'Task'},
'parent': {
"key": epic_key
}
}
new_issue = jira.issue_create(fields=issue_dict)
0 votes
Benjamin
Community Champion
June 1, 2024

Hi @Krishnadhas N K ,

 

Welcome to the community!

Alternatively, you can use the automation built into Jira Cloud to put together an automated solution. For example, you can do things like change in Epic trigger a creating a ticket to attach to the associated Epic. There's quite a number of various scenarios you can do. Would recommend exploring.

Krishnadhas N K June 2, 2024

Hello @Benjamin ,

 

I am doing an automation to create jira stories ( tasks) programatically using python SDK (atlassian python SDK) . My use case is whenever a security vulnerabilities is detected by using github rest api on any of my repos in GitHub, I need to create a story and attach it to a specific epic. I will be running the script as cron job leveraging python.
I am able to create story successfully but not able to attach it to epic programatically. 
I don't want to make any changes to existing work flow in jira as well. 
Hope you understand the better picture of my work.
let me know if you have any questions
Krishnadhas N K June 14, 2024

Hello @Benjamin 

Can you help me out. I was out for few days. I am stuck here for more than a month now and was unable to proceed any further. any help is greatly appreciated.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events