Skip to content

Commit 4ca49f7

Browse files
authored
convert arrays to comma sep string (#261)
1 parent 730ae64 commit 4ca49f7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

ServiceNow/Private/Invoke-ServiceNowRestMethod.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function Invoke-ServiceNowRestMethod {
130130
}
131131

132132
if ( $Values ) {
133-
$Body = $Values | ConvertTo-Json
133+
$Body = $Values | ConvertTo-Json -Compress
134134
$params.Body = $Body
135135
Write-Verbose ($params | ConvertTo-Json)
136136

ServiceNow/Public/Update-ServiceNowRecord.ps1

+7
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ function Update-ServiceNowRecord {
105105

106106
if ( $PSBoundParameters.ContainsKey('InputData') ) {
107107

108+
# arrays should be passed as comma-separated
109+
foreach ($key in @($InputData.Keys)) {
110+
if ( $InputData[$key].GetType().IsArray ) {
111+
$InputData[$key] = $InputData[$key] -join ','
112+
}
113+
}
114+
108115
$params = @{
109116
Method = 'Patch'
110117
Table = $thisTable.Name

0 commit comments

Comments
 (0)