Invalid custom field value for field id 81

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
Firmbyte
Posts: 12
Joined: 07 Feb 2017, 17:23

Invalid custom field value for field id 81

Post by Firmbyte »

I've been using a PowerShell Function for a few years now that is suddenly throwing an error.

Code: Select all

Exception calling "mc_issue_update" with "4" argument(s): "Invalid custom field value for field id 81 ."
At line:29 char:44
+ $mantis.mc_issue_update($($Sec.Username),$($Sec.Password),$ticket,$ticketUpdate)
+                                            ~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SoapHeaderException
The Function is Set-MantisTicket below, which I call like this:

Code: Select all

Set-MantisTicket -ticket $ticket -id $id -status "resolved" -note "Ticket $($ticket) has been completed.`nPlease test and post results into this ticket for audit purposes"

Code: Select all

Function Set-MantisTicket
{
   [cmdletbinding()]
    param(
        [parameter(Mandatory=$true)]
        [string]$ticket,
        [Parameter(Mandatory=$true)]
        [ValidateSet('feedback','acknowledged','confirmed','assigned','resolved','closed')]
        [string]$status,
        [string]$note,
        [string]$id,
        [switch]$assigntoreporter
    )

$Sec = Get-YourLogin $id

    Switch ($status){
        'feedback' {$statusid = '20'}
        'acknowledged' {$statusid = '30'}
        'confirmed' {$statusid = '40'}
        'assigned' {$statusid = '50'}
        'resolved' {$statusid = '80'}
        'closed' {$statusid = '90'}
        }

$mantis = New-WebServiceProxy -Uri http://tickets.empyreanbenefits.com/api/soap/mantisconnect.php?wsdl
$ticketinfo = $mantis.mc_issue_get($($Sec.Username),$($Sec.Password),$ticket)

$ticketUpdate = $ticketinfo
$ticketUpdate.status.id = $statusid #"40" # 30 = acknowledged

$AccountData = New-Object "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_mantisconnect_php_wsdl.AccountData"
#$AccountData.name = $($Sec.Username)
if($assigntoreporter) {
    $AccountData.name = $ticketinfo.reporter.name
    }
    else {
            $AccountData.name = $($Sec.Username)
            }
$issueNoteData = New-Object "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_mantisconnect_php_wsdl.IssueNoteData"
$issueNoteData.text = $note
$ticketUpdate.handler = $AccountData
$ticketUpdate.notes = $issueNoteData
$mantis.mc_issue_update($($Sec.Username),$($Sec.Password),$ticket,$ticketUpdate)

}

Any help or suggestions greatfully received.
Thanks in advance.
Firmbyte
Posts: 12
Joined: 07 Feb 2017, 17:23

Re: Invalid custom field value for field id 81

Post by Firmbyte »

I've found what caused this.
The scripts I had were reading the Mantis tickets and finding the values in the fields but in the Mantis database those values were no longer there. So when I edited the ticket, the field was actually blank, but before editing, it appeared to have a value and the script querying it was given a value. But when the mc_issue_update was being executed, it failed, as the field was in fact empty.
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Invalid custom field value for field id 81

Post by atrol »

This change might have caused your issue https://www.mantisbt.org/bugs/view.php?id=24795
Please use Search before posting and read the Manual
Post Reply