创建螳螂票时插入到custom_fields

时间:2019-05-14 18:24:33

标签: mantis

我正在尝试插入故障单的custom_fields中的字段。我必须插入/更新所有custom_fields,但是具体来说,在故障单中有一个名为“ CSG Director”的字段,我想在创建新故障单时插入并更新值(如果存在)。 我现在尝试执行的操作有误。我可以看到该值不是$ custom的一部分,但无法弄清楚应如何插入。

螳螂门票中的字段是这样的

ID  Name                           value
--  ----                           -----
248 Control ID
145 CSG Director                   Bloggs
200 Complexity
279 Platform
$mantis = New-WebServiceProxy -Uri "http://tickets.mycompany.com/api/soap/mantisconnect.php?wsdl"
$ticketinfo = $mantis.mc_issue_get($($Sec.Username),$($Sec.Password),$ticket)
$ticketUpdate = $ticketinfo
$Custom = New-Object "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy3pi_soap_mantisconnect_php_wsdl.ObjectRef"
$Custom.Value = 'ibarnetson' 
$Custom.id = 145
$ticketUpdate.custom_fields = $Custom
$mantis.mc_issue_update($($Sec.Username),$($Sec.Password),$ticket,$ticketUpdate) 

我也尝试使用

"Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_mantisconnect_php_wsdl.CustomFieldValueForIssueData"

我收到此错误

The property 'Value' cannot be found on this object. Verify that the property exists and can be set.

任何帮助都得到了极大的帮助。

1 个答案:

答案 0 :(得分:0)

我弄破了它,虽然不漂亮,但能完成工作。...


$mantis = New-WebServiceProxy -Uri "http://ticketsdemo2.empyreanbenefits.com/api/soap/mantisconnect.php?wsdl"
$issue  = New-Object ($mantis.GetType().Namespace + ".issuedata")
$project = New-Object ($mantis.GetType().Namespace + ".ObjectRef")
$project.id = $ProjectId
$project.name = $ProjectName
$Reporter = New-Object ($mantis.GetType().Namespace + ".AccountData")
$Reporter.name = $ReporterName
$Handler = New-Object ($mantis.GetType().Namespace + ".AccountData")
$Handler.name = $HandlerName
$Custom = New-Object ($mantis.GetType().Namespace + ".ObjectRef")
$Custom.id = 145
$CustomFields = New-Object ($mantis.GetType().Namespace + ".CustomFieldValueForIssueData")
$CustomFields.field = $Custom
$CustomFields.value = 'Other'
$issue.custom_fields = $CustomFields
$issue.project = $project
$issue.Reporter = $Reporter
$issue.Handler = $Handler
$issue.summary = $summary 
$issue.description = $description 
$issue.category = $category 
$response = $mantis.mc_issue_add(($Sec.Username),$($Sec.Password),$issue)
Return $response