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

发布于 2024-11-06 06:04:15 字数 682 浏览 3 评论 0原文

使用 JIRA 版本 4.2。使用 Python 2.7 和 suds 0.4,如何创建受让人字段集的问题?下面的代码中将忽略受让人字段。

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']},
                ]
            })

我知道您可以与受让人更新问题(请参阅我的答案),但我想在创建问题时分配问题。这可能吗?

注意:我们所有的用户名都是用户的电子邮件地址,包含“@”和“.”符号。

Using JIRA version 4.2. With Python 2.7 and suds 0.4, how can I create an issue with assignee field set? 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

梦中楼上月下 2024-11-13 06:04:15

感谢 Dave 提供了与受让人更新问题的替代方案。请注意,这并不能回答创建问题时如何分配票证的问题。

我需要传递一个数组作为受让人字段的值,即使它只允许一个值。 (这同样适用于您想要使用 updateIssue 调用更新的任何字段)。因此,不要这样做

client.service.updateIssue(auth, 'NAHLP-38630', {'assignee': '[email protected]',})

client.service.updateIssue(auth,'NAHLP-38630',[ {'id' : 'assignee', 'values' : ['[email protected]']}])

Thanks to Dave for this alternative of updating the issue with an assignee. 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). So, instead of:

client.service.updateIssue(auth, 'NAHLP-38630', {'assignee': '[email protected]',})

do this:

client.service.updateIssue(auth,'NAHLP-38630',[ {'id' : 'assignee', 'values' : ['[email protected]']}])
萌辣 2024-11-13 06:04:15

您应该能够创建问题并设置受让人。确保您使用的是用户名,而不是全名或电子邮件地址。检查 atlassian-jira.log 是否有错误。检查该项目中该问题类型的创建屏幕上是否隐藏了受让人。 JIRA Python CLI 有一个 createissues 操作,应该对 suds 执行此操作。

〜马特

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. 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.

~Matt

来世叙缘 2024-11-13 06:04:15

再次感谢戴夫的回答。

Soap API 不会在工作流程的相关点设置 Jira UI 屏幕上不可见的字段。当您调用 createIssue 方法时,“创建问题”屏幕被视为相关屏幕,但受让人字段在“创建问题”屏幕上不可见。

您可以在没有受让人的情况下执行 createissue 调用,然后使用 updateissue 调用来设置受让人。或者,我们可以在初始创建问题工作流程中添加受让人字段。

Thanks to Dave, again, for this answer.

The soap API won't set fields that aren't visible on the Jira UI's screen at the relevant point of the workflow. 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.

You could either do your createissue call without the assignee, then follow it with an updateissue call to set assignee. Alternatively, we could add the assignee field in the initial create issue workflow.

栀子花开つ 2024-11-13 06:04:15

将受让人作为字典传递,键作为名称,如下面的示例所示

issue_data = {   
    'project' : {'key':'project_id'},
    'summary' : 'Issue Creation using Automation Scription',
    'description' : 'Setting the description string',
    'issuetype' : {'name':'Bug'},
    'labels' : ['jiraAutomation','label'],
    'assignee': {'name':'jira_user_id'}
}

new_issue = jira.create_issue(fields=issue_data)
print(new_issue.key)

pass the assignee as the dictionary with key as name, As shown in given example below

issue_data = {   
    'project' : {'key':'project_id'},
    'summary' : 'Issue Creation using Automation Scription',
    'description' : 'Setting the description string',
    'issuetype' : {'name':'Bug'},
    'labels' : ['jiraAutomation','label'],
    'assignee': {'name':'jira_user_id'}
}

new_issue = jira.create_issue(fields=issue_data)
print(new_issue.key)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文