你在正确的轨道上。您必须获取 jira 问题的更改日志条目,然后获取该更改日志列表(属性称为历史记录)中与您的自定义字段相关的值的条目。在更改日志项的属性中找出您的自定义字段的名称,field然后仅过滤掉与您的自定义字段相关的历史记录项。
for entry in range(issue.changelog.startAt, issue.changelog.total):
# do your stuff, for example:
history_item = issue.changelog.histories[entry]
timestamp = history_item.created # get the created timestamp of the current changelog entry
author = history_item.author.displayName # get the person who did the change
print(f"The user {author} changed the following fields on {timestamp}:")
changed_items = history_item.items
for item in changed_items:
# depending on the field type, it might make more sense to
# use `item.from` and `item.to` instead of the fromString/toString properties
print(f"Field: {item.field} from {item.fromString} to {item.toString}")
您也可以在开始时使用此 for 循环:
for entry in issue.changelog.histories:
# do your stuff