Forums

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

Create New Issue in JIRA with Assignee,Watchers and Attachment Using Python

Dharmendra Kumar Mishra
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 30, 2018

I'm trying to add create a new issue in JIRA using python with below code which is working but somehow can't able to figure out, how can I add the attachment here along with assignee and Watchers. Also in the description how can I add a formatted description rather than adding only text.

Can anyone help here?

def new_issue(self):        my_date = datetime.datetime.now().date()
        # current_day = datetime.datetime.now().day
        # current_month = datetime.datetime.now().month
        # current_year = datetime.datetime.now().year
        now = datetime.datetime.now().date()        start_month = datetime.datetime(now.year, now.month, 1)        date_on_next_month = start_month + datetime.timedelta(35)        start_next_month = datetime.datetime(date_on_next_month.year, date_on_next_month.month, 1)        last_day_month = start_next_month - datetime.timedelta(1)        sixth_day_month = last_day_month.date() + timedelta(6)
        description = "Hi Team" \
                        "Hope you are doing well." \
                            "Kindly confirm the current advertisers and accounts from the PDF attached." \
                            "Making sure that for each platform the correct account id, " \
                            "advertiser or account name get included in the NDP data for ALL channels." \
                            "Note: Do let us know if there is any account that needs to be removed." \
                            "Please make sure that the media plan is uploaded on the NeoSageCentral SharePoint Folder."\
                            "" \
                                "Thanks,"
        issue_dict = {
            'project': {'key': 'MOS'},
            'issuetype': {'name': 'Reporting'},
            'summary': 'Test NDP Data Audit {} AUS'.format(my_date.strftime('%B')),
            'description': description,
            'customfield_10038': {'value': 'AUS'},
            'customfield_10052': {'value': 'Ad hoc'},
            'customfield_10053': {'value': 'Monthly'},
            'duedate': str(sixth_day_month)}
        new_issue = self.client.create_issue(fields=issue_dict, prefetch=True)

1 answer

0 votes
Gonchik Tsymzhitov
Community Champion
April 12, 2019

Hi! 

Sorry, from your request so hard to understand which module are you using? 

https://pypi.org/project/atlassian-python-api/

https://pypi.org/project/jira/

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events