Skip to content

Commit

Permalink
convert arrays to comma sep string (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbarron authored Jul 12, 2024
1 parent 730ae64 commit 4ca49f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ServiceNow/Private/Invoke-ServiceNowRestMethod.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function Invoke-ServiceNowRestMethod {
}

if ( $Values ) {
$Body = $Values | ConvertTo-Json
$Body = $Values | ConvertTo-Json -Compress
$params.Body = $Body
Write-Verbose ($params | ConvertTo-Json)

Expand Down
7 changes: 7 additions & 0 deletions ServiceNow/Public/Update-ServiceNowRecord.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ function Update-ServiceNowRecord {

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

# arrays should be passed as comma-separated
foreach ($key in @($InputData.Keys)) {
if ( $InputData[$key].GetType().IsArray ) {
$InputData[$key] = $InputData[$key] -join ','
}
}

$params = @{
Method = 'Patch'
Table = $thisTable.Name
Expand Down

0 comments on commit 4ca49f7

Please sign in to comment.