Skip to content

Commit 3bd3bbd

Browse files
committed
v1.2.1 - Bug fix on Update-ServiceNowNumber
1 parent 7b62f38 commit 3bd3bbd

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

ServiceNow/Public/Update-ServiceNowNumber.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,25 @@ Function Update-ServiceNowNumber {
6060
begin {}
6161
process {
6262
Try {
63-
# Use the number and table to determine the sys_id
63+
# Prep a splat to use the provided number to find the sys_id
6464
$getServiceNowTableEntry = @{
6565
Table = $Table
6666
MatchExact = @{number = $number}
67-
Credential = $Credential
68-
ServiceNowURL = $ServiceNowURL
6967
ErrorAction = 'Stop'
7068
}
71-
$SysID = Get-ServiceNowTableEntry @getServiceNowTableEntry | Select-Object -Expand sys_id
7269

7370
# Process credential steps based on parameter set name
7471
Switch ($PSCmdlet.ParameterSetName) {
7572
'SpecifyConnectionFields' {
7673
$ServiceNowURL = 'https://' + $ServiceNowURL + '/api/now/v1'
74+
$updateServiceNowTableEntrySplat.Add('ServiceNowCredential',$ServiceNowCredential)
75+
$updateServiceNowTableEntrySplat.Add('ServiceNowURL',$ServiceNowURL)
7776
}
7877
'UseConnectionObject' {
7978
$SecurePassword = ConvertTo-SecureString $Connection.Password -AsPlainText -Force
8079
$Credential = New-Object System.Management.Automation.PSCredential ($Connection.Username, $SecurePassword)
8180
$ServiceNowURL = 'https://' + $Connection.ServiceNowUri + '/api/now/v1'
81+
$updateServiceNowTableEntrySplat.Add('Connection',$Connection)
8282
}
8383
Default {
8484
If ((Test-ServiceNowAuthIsSet)) {
@@ -91,6 +91,9 @@ Function Update-ServiceNowNumber {
9191
}
9292
}
9393

94+
# Use the number and table to determine the sys_id
95+
$SysID = Get-ServiceNowTableEntry @getServiceNowTableEntry | Select-Object -Expand sys_id
96+
9497
# Convert the values to Json and encode them to an UTF8 array to support special chars
9598
$Body = $Values | ConvertTo-Json
9699
$utf8Bytes = [System.Text.Encoding]::Utf8.GetBytes($Body)

ServiceNow/ServiceNow.psd1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'ServiceNow.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.2.0'
15+
ModuleVersion = '1.2.1'
1616

1717
# ID used to uniquely identify this module
1818
GUID = 'b90d67da-f8d0-4406-ad74-89d169cd0633'
@@ -99,3 +99,7 @@ PrivateData = @{
9999
# DefaultCommandPrefix = ''
100100

101101
}
102+
103+
104+
105+

0 commit comments

Comments
 (0)