Last active
August 28, 2020 14:47
-
-
Save davejlong/a9e31734f42da96a2217520a4912d0cf to your computer and use it in GitHub Desktop.
Using the PSAtera module to automatically switch tickets from Pending to Open when the "Scheduled For" field is today.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module PSAtera -MinimumVersion 1.4.0 | |
$Tickets = Get-AteraTicketsFiltered -Pending | |
foreach($Ticket in $Tickets) { | |
$ScheduledDate = Get-AteraCustomValue -ObjectType Ticket -ObjectID $Ticket.TicketID -FieldName "Scheduled For" | |
if ($null -eq $ScheduledDate.ValueAsDateTime) { return } | |
if ((Get-Date -Date $ScheduledDate.ValueAsDateTime) -le (Get-Date)) { | |
Set-AteraTicket -TicketID $Ticket.TicketID -TicketStatus "Open" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment