Pau*_*son 10 python jira custom-fields
如何在jira-python中确定自定义字段的名称?
当我检索到问题时,我的自定义字段显示为customfield_xxx
我的屏幕上的名称是"项目","名称","截止日期"等.在每个字段中放置一个值,然后在重新阅读问题时查看它出现的位置.
那就是我可以在我的一个字段中加上'a',然后阅读问题,并发现customfield_10801(或其他)的值为'a'.但有没有一种通用的方法来查找,例如,如果我的自定义字段是'截止日期',customfield_xxx是否会映射到它?
或者,在JIRA GUI中,我将如何查找这些customfield#.
Luk*_*lar 17
从GUI中,您可以在html代码或url中看到自定义字段ID:
另一种方法是通过REST API:
更新:
根据评论,可以这样做:
# Fetch all fields
allfields=jira.fields()
# Make a map from field name -> field id
nameMap = {field['name']:field['id'] for field in allfields}
# Fetch an issue
issue = jira.issue('ABC-1')
# You can now look up custom fields by name using the map
getattr(issue.fields, nameMap[custom_name])
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8491 次 |
| 最近记录: |