简而言之,我从 REST API 创建了一个继承流程,当我尝试添加状态或字段时,我收到错误,因为它使用原始工作项中的引用名称,而不是它自己的。
例如:
Microsoft.VSTS.WorkItemTypes.Bug
而不是processName.Bug
。
function newProcess {
param (
[Parameter(Mandatory)] [string] $organization,
[Parameter(Mandatory)] [string] $process,
[Parameter(Mandatory)] [string] $description,
[Parameter(Mandatory)] [string] $parent,
[Parameter(Mandatory)] [hashtable] $header
)
[string] $uri = "https://dev.azure.com/{0}/_apis/work/processes?{1}" -f $organization, $apiVersion
[string] $body = @{ name = $process; parentProcessTypeId = (getProcessId -organization $organization -process $parent -header $header); description = $description } | ConvertTo-Json
try {
[string] $id = (Invoke-RestMethod -Uri $uri -Method Post -ContentType application/json -Body $body -Headers $header).typeId
Start-Sleep -Seconds 1.0
if ( $id -eq (getProcessId -organization $organization -process $process -header $header) ) {
Write-Host " - Process '$process' successfully created in organization $organization !"
return ($id)
} else {
throw
}
} catch {
Write-Host "##[error] An error occurred while creating the Process $process in the organization $organization at $uri"
Get-Error
throw
}
}
如果我从 Azure 手动更新状态或字段,它将更改名称,如何从 Azure REST API 自动执行此操作?
要开始在继承流程中编辑工作项类型,请创建继承的工作项类型。使用此方法工作项类型 - 创建并添加此引用:
inheritsFrom - 工作项类型的父工作项类型