简体   繁体   中英

inserting to custom_fields when creating Mantis ticket

I'm trying to insert to fields in custom_fields in a ticket. I'll have to insert/update all the custom_fields, but specifically, in the ticket there is a field called " CSG Director" and I want to insert when I create a new ticket and update the value if existing. How I'm trying to do it now is erroring. I can see that the value is not part of the $custom but can't figure out how I should be inserting that.

The fields in the Mantis ticket are like this

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) 

I've also tried using

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

I get this error

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

Any help greatfully received.

I got it cracked, not pretty but does the job....


$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 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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