Skip to content

Commit 6771b97

Browse files
committed
account for empty table class names
1 parent a942875 commit 6771b97

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

ServiceNow/ServiceNow.psm1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ Write-Verbose $PSScriptRoot
55

66
$config = ConvertFrom-Json (Get-Content "$PSScriptRoot\Config\main.json" -Raw)
77
$Script:ServiceNowOperator = $config.FilterOperators
8-
$script:ServiceNowTable = $config.Tables
8+
[System.Collections.ArrayList] $script:ServiceNowTable = $config.Tables
99

1010
Export-ModuleMember -Variable ServiceNowOperator, ServiceNowTable
1111

1212
$tableArgCompleterSb = {
13-
$ServiceNowTable.ClassName | ForEach-Object {
14-
'''{0}''' -f $_
13+
$ServiceNowTable | ForEach-Object {
14+
if ( $_.ClassName ) {
15+
'''{0}''' -f $_.ClassName
16+
} else {
17+
'''{0}''' -f $_.Name
18+
}
1519
}
1620
}
1721

@@ -55,7 +59,7 @@ $aliases = @{
5559
'Remove-ServiceNowTableEntry' = 'Remove-ServiceNowRecord'
5660
'New-ServiceNowTableEntry' = 'New-ServiceNowRecord'
5761
'Update-ServiceNowTableEntry' = 'Update-ServiceNowRecord'
58-
'Update-ServiceNowNumber' = 'Update-ServiceNowRecord'
62+
'Update-ServiceNowNumber' = 'Update-ServiceNowRecord'
5963
'gsnr' = 'Get-ServiceNowRecord'
6064
}
6165
$aliases.GetEnumerator() | ForEach-Object {

0 commit comments

Comments
 (0)