Skip to content

Commit 39823cf

Browse files
Add -Fields param to Get-ServiceNowTable
1 parent d0f05b2 commit 39823cf

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ServiceNow/Public/Get-ServiceNowTable.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ function Get-ServiceNowTable {
3535
[parameter(ParameterSetName = 'SetGlobalAuth')]
3636
[int]$Limit = 10,
3737

38+
# Fields to return
39+
[parameter(mandatory = $false)]
40+
[parameter(ParameterSetName = 'SpecifyConnectionFields')]
41+
[parameter(ParameterSetName = 'UseConnectionObject')]
42+
[parameter(ParameterSetName = 'SetGlobalAuth')]
43+
[string[]]$Fields,
44+
3845
# Whether or not to show human readable display values instead of machine values
3946
[parameter(ParameterSetName = 'SpecifyConnectionFields')]
4047
[parameter(ParameterSetName = 'UseConnectionObject')]
@@ -84,6 +91,10 @@ function Get-ServiceNowTable {
8491
$Body.sysparm_query = $Query
8592
}
8693

94+
if ($Fields) {
95+
$Body.sysparm_fields = $Fields -join ','
96+
}
97+
8798
# Perform table query and capture results
8899
$Uri = $ServiceNowURL + "/table/$Table"
89100
$Result = (Invoke-RestMethod -Uri $Uri -Credential $ServiceNowCredential -Body $Body -ContentType "application/json").Result

0 commit comments

Comments
 (0)