Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I update Jira with Target End Date, End Date and Target Start Date through python?

Keerthi Pandrapragada
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!
March 4, 2024

Here is the code snippet :

def dCalculateDates():
jStartDate = datetime.now()
jEndDate = jStartDate + timedelta(days=jTimeDeltaStartEnd)

jTimeProcess = jStartDate.strftime('%Y-%m-%d')
jStartDate = str(jTimeProcess)
jTargetStartDate = jStartDate

jTimeProcess = jEndDate.strftime('%Y-%m-%d')
jEndDate = str(jTimeProcess)
jTargetEndDate = jEndDate

print(f"{script_info} - jStartDate = {jStartDate} jTargetStartDate = {jTargetStartDate} jEndDate = {jEndDate} jTargetEndDate = {jTargetEndDate}")
return jEndDate, jTargetEndDate, jTargetStartDate, jStartDate

 

And updating it into Jira as:

json_data_task = {
"fields":{
"project":{
"key": jDWCProjectKey
},
"summary": task_info[0]["summary"],
"description": task_info[0]["description"],
"issuetype":{
"name":"Task"
},

"assignee":{
"name": jASSIGNEE
},
"customfield_10002" : jC20DebugOpens,
"customfield_10009" : jThisTargetStartDate,
"customfield_10010" : jThisTargetEndDate,
"customfield_10021" : jProductL1,
"customfield_10022" : jProductL2,
"customfield_10023" : jProductL3,
"customfield_10024" : jProductL4,
"customfield_11306" : jThisStartDate,
"customfield_13202" : jThisEndDate
},
"update":{
"issuelinks":[
{
"add":{
"type":{
"name":"Blocks",
"inward":"is blocked by",
"outward":"blocks"
},
"outwardIssue":{
"key":jSTORY
}
}
}
]
}
}

The error Iam facing is:

jStartDate = 2024-03-04 jTargetStartDate = 2024-03-04 jEndDate = 2024-03-09 jTargetEndDate = 2024-03-09

task_json_rsp : b'{"errorMessages":[],"errors":{"customfield_10010":"Field \'customfield_10010\' cannot be set. It is not on the appropriate screen, or unknown.","customfield_10009":"Field \'customfield_10009\' cannot be set. It is not on the appropriate screen, or unknown.","customfield_13202":"Field \'customfield_13202\' cannot be set. It is not on the appropriate screen, or unknown."}}'

And According to me the custom_fields in script corresponds to the field itself.And the format of the dates are also upto the mark. 

Could you please help me out with this?

Warm Regards,

Keerthi

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events