【问题标题】:Create multiple tasks when a user story is created and Add Link as Child in Azure DevOps创建用户故事时创建多个任务并在 Azure DevOps 中将链接添加为子项
【发布时间】:2022-08-14 04:37:49
【问题描述】:

我们正在使用 Power Automate 来自动化每个 sprint 中的一些常规活动。因此,我想创建一个“一旦创建用户故事并符合条件”的流程,应该创建一些任务并将其作为子项链接到用户故事。

此外,我可以看到电源自动化中已经有一个模板可以创建任务但不链接它。

    标签: azure-devops power-automate power-automate-custom-connector


    【解决方案1】:

    根据您的描述和关心,经过我的测试,我们可以使用 Rest API 自动链接工作项。也可以参考 Rest API 我们可以在 Power Automate 中设置相应的配置。

    首先,这里是 Rest API 中的步骤:

    1.发帖:https://dev.azure.com/{Orgname}/_apis/wit/$batch?api-version=4.1

    2.参见下面的“Body”参考:

    [
        {
          "method": "PATCH",
          "uri": "/_apis/wit/workitems/{Source work item ID1}?api-version=4.1",
          "headers": {
            "Content-Type": "application/json-patch+json"
          },
          "body": [
            
            {
              "op": "add",
              "path": "/relations/-",
              "value": {
                "rel": "System.LinkTypes.Hierarchy-Reverse",
                "url": "https://dev.azure.com/{Orgname}/_apis/wit/workItems/{Target work item ID}",
                "attributes": {
                "comment": "Making a new link for the dependency"
                              }
                       }
            }
          ]
        },
        {
          "method": "PATCH",
          "uri": "/_apis/wit/workitems/{Source work item ID2}?api-version=4.1",
          "headers": {
            "Content-Type": "application/json-patch+json"
          },
          "body": [
           
            {
              "op": "add",
              "path": "/relations/-",
              "value": {
                "rel": "System.LinkTypes.Hierarchy-Reverse",
                "url": "https://dev.azure.com/{Orgname}/_apis/wit/workItems/{Target work item ID}",
                "attributes": {
                "comment": "Making a new link for the dependency"
                              }
                       }
            }
          ]
        }
      ]
    

    3.记得添加PAT token:

    4.结果图片: (1)

    (2)在组织用户界面中:

    其次,查看 Power Automate 中对应的示例设置:

    1.创建工作项后,自动将任务链接到用户故事。

    (1).在Operation中搜索“http”。

    然后在 HTTP 中设置配置。

    (2).设置完成后,先“保存”检查流程是否可以成功运行,然后选择“手动”选择“测试”。

    (3).最后,它也有效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-18
      • 1970-01-01
      • 2020-03-10
      • 1970-01-01
      • 2020-11-24
      • 2020-09-22
      相关资源
      最近更新 更多