AndrewPla / TOPdeskPS

PowerShell module to interact with the TOPdesk API
MIT License
30 stars 12 forks source link

Set-tdIncident -ClosureCode won't apply #112

Closed DAJ321 closed 3 years ago

DAJ321 commented 3 years ago

Prerequisites

Put an X between the brackets on each line to confirm you have completed them:

Running the below Set-TdIncident -Number I1811-123 -ClosureCode (Get-TdClosureCode Completed).id

Returns the error:

`Invoke-RestMethod : [{"message":"No fields changed"}] At C:\TOPdeskPS.psm1:4079 char:17 Invoke-RestMethod @Params


 CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand`

**Expected behavior**
Set Closure Code to completed

**System Details**

- Operating System: Windows 10
- PowerShell Version: 5.1.18362.752
- Architecture for PowerShell Session: 64bit 
- Is this system an Azure Automation Worker?: No

**Additional context**
Running
`Get-TdClosureCode Completed`
Does work and brings back the id fine.

"-ProcessingStatus (get-tdprocessingstatus Completed).id" works fine
DAJ321 commented 3 years ago

I've fixed this by adding the below in to Set-TdIncident

        ClosureCode {
            $val = @{id = $ClosureCode}
            $body | Add-Member -MemberType NoteProperty -name closureCode -Value $val
        }