hi,
I am trying to automate the creation of release note on jira by python
the following is the jira screenshot about how to create a release note on Jira in manual way
the following is my python code
-----------------------------------------------------------------------------------------------------
from jira import JIRA
from jira.client import JIRA
import cgi
import requests
import re
from requests.packages.urllib3.exceptions import InsecureRequestWarning
import sys
import json
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
jira_server = 'https://pd.nextestate.com'
jira_user = 'szhang1'
jira_password = 'myPasswordHere' #pls input your correct password here
jira_server = jira_server
jira_project_key = 'Transactions and Money Movement'
options = {
'server': jira_server
}
jira = JIRA(options, basic_auth=(jira_user, jira_password))
projectKey='Legacy(LEG)'
ChangeLIST='12345' #customfield_14305
ScriptExecutionOrder=' Update_PartnerProgramConfiguration_20210906.sql' #customfield_14303
issueLinkType ="relates to"
storyID='MOTX-73337'
storySummary='MM- 15k bin update at retailer'
inward_issue_key='MOTX-73337'
outward_issue_key='MOTX-73337'
ReleaseNoteTemplate = {
'project' : { 'key' : 'LEG' },
'issuetype' : { 'name' : 'Release Note' },
'summary' : storySummary,
'customfield_14300' : [{'value': 'Database'}],
'customfield_14303' : ScriptExecutionOrder ,
'customfield_14305' : ChangeLIST ,
"issuelinks": [
{
"add": {
"type": {
"name": "relates to"
},
"inwardIssue": {
"key": inward_issue_key
}
}
}
]
}
child = jira.create_issue(fields=ReleaseNoteTemplate,issue=storyID)
print("created child lev2: " + child.key +" For "+issue+ " "+ storySummary )
--------------------------------------------------------------------------------------------------
I am always getting the following error when executing above python script
raise JIRAError(
jira.exceptions.JIRAError: JiraError HTTP 400 url: https://pd.nextestate.com/rest/api/2/issue
text: Field does not support update 'issuelinks'
response headers = {'X-AREQUESTID': '1407x1400765x1', 'X-ASESSIONID': '1w9w5rq', 'X-ANODEID': 'g1node02', 'Referrer-Policy': 'strict-origin-when-cross-origin', 'X-XSS-Protection': '1; mode=block', 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'SAMEORIGIN', 'Content-Security-Policy': "frame-ancestors 'self'", 'Strict-Transport-Security': 'max-age=31536000', 'X-Seraph-LoginReason': 'OK', 'X-AUSERNAME': 'szhang1', 'Cache-Control': 'no-cache, no-store, no-transform', 'Content-Encoding': 'gzip', 'Vary': 'User-Agent', 'Content-Type': 'application/json;charset=UTF-8', 'Transfer-Encoding': 'chunked', 'Date': 'Sun, 10 Oct 2021 06:27:07 GMT', 'Connection': 'close'}
response text = {"errorMessages":[],"errors":{"issuelinks":"Field does not support update 'issuelinks'"}}
could you please provide guidance how to resolve such issue so that the release note can be created by python code just like manual way
It looks like there is some sort of restriction on the issue types you can link. Check on the workflow validator if there is anything.
Regards
hi @Fabian Lim
thanks for your reply !
there is no any restriction to complete this in manual way, I doubt the method of create_issue() doesn't support the creation of issue and linked to another issue at the same time
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The message in red in your screenshot is coming from a validator on the create issue process.
I suspect that validator is failing your attempt to create the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your reply.
my original screenshot is a little bit confusing, Sorry for that, that message in red is due to that i didn't input any issue link in the beginning and that field is mandatory field.
I re-attached below correct screenshot as below, there is no any issue using manual way to create a issue with issue type of "Release Note"
My questions is how to resolve the errors I met when trying to use python code to call create_issue() method to do the same thing as manual way.
The screenshot is just for your quick look/understanding about what function i am trying to achieve.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, I don't know how your python libraries are treating your issue link data, but I'm going to guess that they're not recognising it as links.
The REST API call for linking issues is https://docs.atlassian.com/software/jira/docs/api/REST/8.19.1/#issueLink and does not treat the issues link field as a field (because it isn't one)
I think your python library needs to handle the link data separately, after issue creation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks @Nic Brough -Adaptavist-
I think about that before as well, but the linked issues and issue field are mandatory fields when creating issue, so the link data can not be handled separately after issue creation
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.