Skip to content

Commit a4d77e7

Browse files
committed
fix paging, prop name updates
1 parent 8595d5b commit a4d77e7

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

ServiceNow/Private/Invoke-ServiceNowRestMethod.ps1

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@ function Invoke-ServiceNowRestMethod {
5252

5353
# Fields to return
5454
[Parameter()]
55-
[Alias('Fields')]
56-
[string[]] $Properties,
55+
[Alias('Fields', 'Properties')]
56+
[string[]] $Property,
5757

5858
# Whether or not to show human readable display values instead of machine values
5959
[Parameter()]
6060
[ValidateSet('true', 'false', 'all')]
61-
[string] $DisplayValues = 'true',
61+
[Alias('DisplayValues')]
62+
[string] $DisplayValue = 'true',
6263

6364
[Parameter()]
6465
[PSCredential] $Credential,
@@ -104,7 +105,7 @@ function Invoke-ServiceNowRestMethod {
104105

105106
if ( $Method -eq 'Get') {
106107
$Body = @{
107-
'sysparm_display_value' = $DisplayValues
108+
'sysparm_display_value' = $DisplayValue
108109
'sysparm_query' = (New-ServiceNowQuery -Filter $Filter -Sort $Sort)
109110
'sysparm_limit' = 10
110111
}
@@ -128,8 +129,8 @@ function Invoke-ServiceNowRestMethod {
128129
$Body.sysparm_query = $Query
129130
}
130131

131-
if ($Properties) {
132-
$Body.sysparm_fields = ($Properties -join ',').ToLower()
132+
if ($Property) {
133+
$Body.sysparm_fields = ($Property -join ',').ToLower()
133134
}
134135
}
135136

ServiceNow/Public/Get-ServiceNowRecord.ps1

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,26 @@ function Get-ServiceNowRecord {
122122
[hashtable] $ServiceNowSession = $script:ServiceNowSession
123123
)
124124

125-
$invokeParams = @{
126-
Table = $Table
127-
Properties = $Property
128-
Filter = $Filter
129-
Sort = $Sort
130-
DisplayValues = $DisplayValue
131-
Connection = $Connection
132-
ServiceNowSession = $ServiceNowSession
133-
}
125+
# $invokeParams = @{
126+
# Table = $Table
127+
# Properties = $Property
128+
# Filter = $Filter
129+
# Sort = $Sort
130+
# DisplayValues = $DisplayValue
131+
# Connection = $Connection
132+
# ServiceNowSession = $ServiceNowSession
133+
# }
134+
135+
$invokeParams = $PSBoundParameters
136+
$invokeParams.Remove('IncludeCustomVariable') | Out-Null
134137

135138
$addedSysIdProp = $false
136139

137140
# we need the sys_id value in order to get custom var data
138141
# add it in if specific properties were requested and not part of the list
139142
if ( $IncludeCustomVariable.IsPresent ) {
140143
if ( $Property -and 'sys_id' -notin $Property ) {
141-
$invokeParams.Properties += 'sys_id'
144+
$invokeParams.Property += 'sys_id'
142145
$addedSysIdProp = $true
143146
}
144147
}

0 commit comments

Comments
 (0)