flycastpartnersinc / FreshservicePS

Powershell Module to interface with Freshworks Freshservice REST API.
MIT License
21 stars 4 forks source link

Set-FSTicket -custom_fields not working? #18

Open nebulight opened 6 months ago

nebulight commented 6 months ago

I'm looking to update tickets custom fields as the ticket that was generated has no custom field and can not be closed without one.

Expected Behavior

I'm trying to run Set-FreshServiceTicket -id TICKET_NUMBER -custom_fields @{requester_impact=My Team;} or Set-FreshServiceTicket -id TICKET_NUMBER -custom_fields @{requester_impact='My Team';} and both give me an error.

Current Behavior

Without the quotes I get:

My : The term 'My' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:68

With the quote I get: Invoke-WebRequest : The remote server returned an error: (400) Bad Request. At C:\Users\USERNAME\Documents\WindowsPowerShell\Modules\FreshservicePS\0.1.6\Private\Invoke-FreshworksRestMethod.ps1:191 char:28

Possible Solution

Steps to Reproduce (for bugs)

1. 2. 3. 4.

Context

Your Environment

rainmakers99STLCC commented 3 months ago

I am able to set a custom field using the PowerShell.
I have a custom field called Building Location, and the following command works when the two PowerShell variables, $ticketIDNumber & $myLocationVariable, are set. Set-FSTicket -id $ticketIDNumber -custom_fields @{building_location=$myLocationVariable}

I've stumbled accross the 400 error as well, and what I've found is typically that means I have a typo of some sort in the hash table. To help address that issue try running a Get-FSTicket, and then copy out the field name you want from an existing ticket. Small typos even upper case vs lower case will cause issues.

Hope this helps Good luck.