lwhitelock / HuduAutomation

72 stars 77 forks source link

Ticket search query? #2

Closed jlinx2 closed 3 years ago

jlinx2 commented 3 years ago

This is the first run of this script and I am working out the integration with AutoTask. I have not gotten to the point in the script to exclude ticket statuses etc. The script seems to be dying on line 124 with this error message. The API user appears to have full access currently. The script runs for about 200 seconds or so before the error is thrown. Any suggestions on what this might be referencing?

Retrieving webservices URI based on username Setting AutotaskBaseURI to https://webservices3.autotask.net/ATServicesRest/ using version V1.0 Setting API resource parameters. This may take a moment. Get-AutotaskAPIResource : Connecting to the Autotask API failed. The remote server returned an error: (500) Internal Server Error. At C:\psHuduAT\HuduAutoTaskMagicDash.ps1:124 char:12

Updated Global Report

lwhitelock commented 3 years ago

Have a check that you have setup some exclusions in the settings at the top for example. $ExcludeStatus = '[5,21,37,38]' $ExcludeType = '[5]' $ExcludeQueue = '[8]'

It is probably these lines that are messing up, so most likely one of those settings at the top:

$TicketFilter = "{"filter":[{"op":"notin","field":"queueID","value":$ExcludeQueue},{"op":"notin","field":"status","value":$ExcludeStatus}]}" $tickets = Get-AutotaskAPIResource -Resource Tickets -SearchQuery $TicketFilter

jlinx2 commented 3 years ago

That seems likely, thank you. I currently do not have any filters defined in those variables up top yet. How do I determine what numbers are associated with each status/type/queue?

jlinx2 commented 3 years ago

That seems likely, thank you. I currently do not have any filters defined in those variables up top yet. How do I determine what numbers are associated with each status/type/queue?

I cannot seem to get the script to produce the table of the statuses, If I plug in a number the script begins running without error. Is there another method to get the number associated with the statuses or the queues?