11function Get-ServiceNowRequest {
22 param (
3+ # Fields to return
4+ [parameter (mandatory = $false )]
5+ [parameter (ParameterSetName = ' SpecifyConnectionFields' )]
6+ [parameter (ParameterSetName = ' UseConnectionObject' )]
7+ [parameter (ParameterSetName = ' SetGlobalAuth' )]
8+ [string []]$Fields ,
9+
310 # Machine name of the field to order by
411 [parameter (mandatory = $false )]
512 [parameter (ParameterSetName = ' SpecifyConnectionFields' )]
613 [parameter (ParameterSetName = ' UseConnectionObject' )]
714 [parameter (ParameterSetName = ' SetGlobalAuth' )]
815 [string ]$OrderBy = ' opened_at' ,
9-
16+
1017 # Direction of ordering (Desc/Asc)
1118 [parameter (mandatory = $false )]
1219 [parameter (ParameterSetName = ' SpecifyConnectionFields' )]
@@ -21,7 +28,7 @@ function Get-ServiceNowRequest {
2128 [parameter (ParameterSetName = ' UseConnectionObject' )]
2229 [parameter (ParameterSetName = ' SetGlobalAuth' )]
2330 [int ]$Limit = 10 ,
24-
31+
2532 # Hashtable containing machine field names and values returned must match exactly (will be combined with AND)
2633 [parameter (mandatory = $false )]
2734 [parameter (ParameterSetName = ' SpecifyConnectionFields' )]
@@ -47,19 +54,19 @@ function Get-ServiceNowRequest {
4754 [Parameter (ParameterSetName = ' SpecifyConnectionFields' , Mandatory = $True )]
4855 [ValidateNotNullOrEmpty ()]
4956 [PSCredential ]
50- $ServiceNowCredential ,
57+ $ServiceNowCredential ,
5158
5259 [Parameter (ParameterSetName = ' SpecifyConnectionFields' , Mandatory = $True )]
5360 [ValidateNotNullOrEmpty ()]
5461 [string ]
55- $ServiceNowURL ,
62+ $ServiceNowURL ,
5663
57- [Parameter (ParameterSetName = ' UseConnectionObject' , Mandatory = $True )]
64+ [Parameter (ParameterSetName = ' UseConnectionObject' , Mandatory = $True )]
5865 [ValidateNotNullOrEmpty ()]
5966 [Hashtable ]
6067 $Connection
6168 )
62-
69+
6370 # Query Splat
6471 $newServiceNowQuerySplat = @ {
6572 OrderBy = $OrderBy
@@ -68,7 +75,7 @@ function Get-ServiceNowRequest {
6875 MatchContains = $MatchContains
6976 }
7077 $Query = New-ServiceNowQuery @newServiceNowQuerySplat
71-
78+
7279 # Table Splat
7380 $getServiceNowTableSplat = @ {
7481 Table = ' sc_request'
@@ -78,7 +85,7 @@ function Get-ServiceNowRequest {
7885 }
7986
8087 # Update the Table Splat if the parameters have values
81- if ($null -ne $PSBoundParameters.Connection ) {
88+ if ($null -ne $PSBoundParameters.Connection ) {
8289 $getServiceNowTableSplat.Add (' Connection' , $Connection )
8390 }
8491 elseif ($null -ne $PSBoundParameters.ServiceNowCredential -and $null -ne $PSBoundParameters.ServiceNowURL ) {
0 commit comments