Skip to content

Commit 51f949f

Browse files
Add -Fields parameter to wrappers
1 parent 39823cf commit 51f949f

File tree

5 files changed

+44
-8
lines changed

5 files changed

+44
-8
lines changed

ServiceNow/Public/Get-ServiceNowChangeRequest.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
function Get-ServiceNowChangeRequest {
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')]

ServiceNow/Public/Get-ServiceNowConfigurationItem.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
function Get-ServiceNowConfigurationItem {
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')]

ServiceNow/Public/Get-ServiceNowIncident.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
function Get-ServiceNowIncident{
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')]

ServiceNow/Public/Get-ServiceNowRequest.ps1

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
function 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) {

ServiceNow/Public/Get-ServiceNowRequestItem.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
function Get-ServiceNowRequestItem {
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')]
@@ -74,6 +81,7 @@ function Get-ServiceNowRequestItem {
7481
Table = 'sc_req_item'
7582
Query = $Query
7683
Limit = $Limit
84+
Fields = $Fields
7785
DisplayValues = $DisplayValues
7886
}
7987

0 commit comments

Comments
 (0)