@@ -32,9 +32,9 @@ function New-HaloPSATicket {
3232 try {
3333 if ($PSCmdlet.ShouldProcess (' Add note to HaloPSA ticket' , ' Add note' )) {
3434 $Action = Invoke-RestMethod - Uri " $ ( $Configuration.ResourceURL ) /actions" - ContentType ' application/json; charset=utf-8' - Method Post - Body $body - Headers @ {Authorization = " Bearer $ ( $token.access_token ) " }
35- Write-Information " Note added to ticket in HaloPSA: $ ( $Action .id ) "
35+ Write-Information " Note added to ticket in HaloPSA: $ ( $ExistingTicket .TicketID ) "
3636 }
37- return
37+ return " Note added to ticket in HaloPSA: $ ( $ExistingTicket .TicketID ) "
3838 } catch {
3939 $Message = if ($_.ErrorDetails.Message ) {
4040 Get-NormalizedError - Message $_.ErrorDetails.Message
@@ -44,7 +44,7 @@ function New-HaloPSATicket {
4444 Write-LogMessage - message " Failed to add note to HaloPSA ticket: $Message " - API ' HaloPSATicket' - sev Error - LogData (Get-CippException - Exception $_ )
4545 Write-Information " Failed to add note to HaloPSA ticket: $Message "
4646 Write-Information " Body we tried to ship: $body "
47- return
47+ return " Failed to add note to HaloPSA ticket: $Message "
4848 }
4949 }
5050 }
@@ -66,6 +66,7 @@ function New-HaloPSATicket {
6666 details_html = $description
6767 donotapplytemplateintheapi = $true
6868 attachments = @ ()
69+ _novalidate = $true
6970 }
7071
7172 if ($Configuration.TicketType ) {
@@ -93,6 +94,7 @@ function New-HaloPSATicket {
9394 Add-CIPPAzDataTableEntity @TicketTable - Entity $TicketObject - Force
9495 Write-Information ' Ticket added to consolidation table'
9596 }
97+ return " Ticket created in HaloPSA: $ ( $Ticket.id ) "
9698 }
9799 } catch {
98100 $Message = if ($_.ErrorDetails.Message ) {
@@ -103,5 +105,6 @@ function New-HaloPSATicket {
103105 Write-LogMessage - message " Failed to send ticket to HaloPSA: $Message " - API ' HaloPSATicket' - sev Error - LogData (Get-CippException - Exception $_ )
104106 Write-Information " Failed to send ticket to HaloPSA: $Message "
105107 Write-Information " Body we tried to ship: $body "
108+ return " Failed to send ticket to HaloPSA: $Message "
106109 }
107110}
0 commit comments