I`m using search from jql method, to receive json with a changelog and names(via python). But the status field is not tied to the history, but is located in the task fields. That is, getting the history of one task, which had 10 changes and it was closed, and unloading it into some database, I will get a table with 10 identical statuses - closed. Is it possible to get the status of each update event in the changelog?
Welcome to the community!
Sorry if I misunderstood your question but as far as I understood you want to get the status of the issue when the issue was updated. As an example, assume the priority field was changed, you would have changeitem like field: priority, oldvalue:High, newvalue:Low
However, you also need the information that the status was Open during the change.
If this is the case, you won't get that information because Jira stores status changes like the other fields and you will get that as a changehistory item. So, I'd suggest iterating a loop and keeping the status field value in a variable, whenever the status field was changed, change the variable accordingly.
I hope I was clear, I'd try to help if you share more details.
Looks like it was harder than i thought. I`ve already parse task_update dict, where i get all the fields i need.
task['components'] = [c['name'] for c in task['fields']['components']]
task['link'] = "my_jira_link" + task['key']
task['data_date'] = arrow.utcnow().format('YYYY-MM-DD')
task['data_time'] = arrow.utcnow().datetime
task['issue_updated'] = arrow.get(task['fields']['updated']).datetime
task['issue_created'] = arrow.get(task['fields']['created']).datetime
if task_update is not None:
change_field = task_update_item['field'].lower()
task['update_id'] = task_update['id']
task['update_author_name'] = task_update['author']['displayName']
task['update_author_user_name'] = task_update['author']['name']
task['update_time'] = arrow.get(task_update['created'])
task['update_field'] = change_field
task['update_from'] = task_update_item['fromString']
task['update_to'] = task_update_item['toString']
if change_field == "sprint":
if task['update_to'] == '':
task['update_to'] = 'Backlog'
if task['update_from'] is None or '':
task['update_from'] = 'Backlog'
Here is the piece of my code.
So now I need to put the status field here, assignee, and duedate - these two fields work in the same way as the status. But if we assume the task has just been created, then the duedate and assignee fields will be empty. Then the status changes, and I need to store its value on all other updates until this status field changes, and then replace it with a new one. So far I don't understand how to implement it.
Hmm, that's tricky. I'd iterate the change items array to find the first status value and use that value until it changes. I mean you have to iterate the list twice, the first iteration will be to find the status change if exists, whenever it finds the change it breaks the loop and moves on to the second loop.