Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set-FSTicket -custom_fields not working? #18

Open
nebulight opened this issue Apr 2, 2024 · 1 comment
Open

Set-FSTicket -custom_fields not working? #18

nebulight opened this issue Apr 2, 2024 · 1 comment

Comments

@nebulight
Copy link

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

  • ... shServiceTicket -id 54483 -custom_fields @{requester_impact=My Team;}
  •                                                             ~~
    
    • CategoryInfo : ObjectNotFound: (My:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

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)

Context

Your Environment

  • Module version used:
  • Operating System and PowerShell version:
@rainmakers99STLCC
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants