简体   繁体   English

通过python suds在JIRA中创建问题时设置受让人字段

[英]Set assignee field when creating an issue in JIRA via Python suds

Using JIRA version 4.2. 使用JIRA 4.2版。 With Python 2.7 and suds 0.4, how can I create an issue with assignee field set? 使用Python 2.7和suds 0.4,如何创建受让人字段集的问题? The assignee field gets ignored in the code below. 在下面的代码中,受让人字段将被忽略。

new_issue = client.service.createIssue(auth, {
            'project': 'NAHLP',
            # issue_type = Incident Report.
            'type': '11',
            'assignee': 'assignee_username',
            'priority': '2',
            'summary': 'summary',
            'description': 'description',
            'customFieldValues': [
                # Reporter Location = NA.
                {'customfieldId':'customfield_10019', 'values':['10011']},
                ]
            })

I know that you can update the issue with an assignee (see my answer) but I want to assign the issue when creating it. 我知道您可以与受让人一起更新问题(请参阅我的答案),但是我想在创建问题时进行分配。 Is this possible? 这可能吗?

Note: All our usernames are the users' email addresses and contain '@' and '.' 注意:我们所有的用户名都是用户的电子邮件地址,并包含“ @”和“。”。 symbols. 符号。

Thanks to Dave for this alternative of updating the issue with an assignee. 感谢Dave提供了与受让人一起更新问题的替代方法。 Note, this does not answer the question of how to assign a ticket when creating an issue. 请注意,这不能回答创建问题时如何分配故障单的问题。

I need to be passing an array as the value of the assignee field even though it only allows one value. 我需要传递一个数组作为受让人字段的值,即使它只允许一个值。 (The same applies to any field you want to update with the updateIssue call). (这同样适用于您要使用updateIssue调用更新的任何字段)。 So, instead of: 因此,代替:

client.service.updateIssue(auth, 'NAHLP-38630', {'assignee': 'qgir@ogilvy.com',})

do this: 做这个:

client.service.updateIssue(auth,'NAHLP-38630',[ {'id' : 'assignee', 'values' : ['qgir@ogilvy.com']}])

You should be able to create an issue and set the assignee. 您应该可以创建问题并设置受让人。 Make sure you're using the user name, not the full name or email address. 确保您使用的是用户名,而不是全名或电子邮件地址。 Check the atlassian-jira.log for errors. 检查atlassian-jira.log中的错误。 Check the assignee is not hidden on the create screen for that issue type in that project. 检查该项目中该问题类型的受让人在创建屏幕上是否处于隐藏状态。 The JIRA Python CLI has a createissues action that should do exactly this with suds. JIRA Python CLI具有createissues动作,应该使用suds精确地执行此操作。

~Matt 〜马特

Thanks to Dave, again, for this answer. 再次感谢Dave的回答。

The soap API won't set fields that aren't visible on the Jira UI's screen at the relevant point of the workflow. soap API不会设置在工作流相关点在Jira UI的屏幕上不可见的字段。 The "create issue" screen is considered the relevant screen when you call the createIssue method, but the assignee field isn't visible on the 'create issue' screen. 调用createIssue方法时,“创建问题”屏幕被视为相关屏幕,但“创建问题”屏幕上看不到受让人字段。

You could either do your createissue call without the assignee, then follow it with an updateissue call to set assignee. 您可以在没有受让人的情况下进行createissue调用,然后在其后进行updateissue调用以设置受让人。 Alternatively, we could add the assignee field in the initial create issue workflow. 或者,我们可以在初始创建问题工作流程中添加受让人字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM