Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
!Deploy!
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Smith committed Jun 1, 2021
1 parent 6db7e61 commit e82c049
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Format as below (Requires the '### Added' as a header or task fails)
...- Update ReadMe.MD

## [Unreleased]
### Added
- Bug fix New-ObjectTypeAttribute not setting defaultTypeId

## [1.14] - 2021-05-31
### Added
Expand Down
21 changes: 11 additions & 10 deletions JSM.Insight/Public/New-ObjectTypeAttribute.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ function New-ObjectTypeAttribute {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started"
$Headers = New-Headers

$ConvertedType = switch ($Type) {
$ConvertedTypeID = switch ($Type) {
"Default" { 0 }
"Object Reference" { 1 }
"User" { 2 }
"Group" { 4 }
"Status" { 7 }
}

$ConvertedTypeID = switch ($defaultTypeId) {
$ConvertedDefaultTypeID = switch ($defaultTypeId) {
"None" { -1 }
"Text" { 0 }
"Integer" { 1 }
Expand All @@ -59,16 +59,16 @@ function New-ObjectTypeAttribute {

$RequestBody = @{
'name' = $Name
'type' = $ConvertedType
'type' = $ConvertedTypeID
}
if ($Label) {
$RequestBody.Add('label', $Label)
$RequestBody.Add('label', [System.Convert]::ToBoolean($Label) )
}
if ($Description) {
$RequestBody.Add('description', $Description)
}
if ($ConvertedTypeID) {
$RequestBody.Add('defaultTypeId', $ConvertedTypeID)
if ($defaultTypeId) {
$RequestBody.Add('defaultTypeId', $ConvertedDefaultTypeID)
}
if ($typeValue) {
$RequestBody.Add('typeValue', $typeValue)
Expand All @@ -89,16 +89,16 @@ function New-ObjectTypeAttribute {
$RequestBody.Add('suffix', $suffix)
}
if ($includeChildObjectTypes -eq $true) {
$RequestBody.Add('includeChildObjectTypes', $includeChildObjectTypes)
$RequestBody.Add('includeChildObjectTypes', [System.Convert]::ToBoolean($includeChildObjectTypes) )
}
if ($hidden -eq $true) {
$RequestBody.Add('hidden', $hidden)
$RequestBody.Add('hidden', [System.Convert]::ToBoolean($hidden) )
}
if ($uniqueAttribute -eq $true) {
$RequestBody.Add('uniqueAttribute', $uniqueAttribute)
$RequestBody.Add('uniqueAttribute', [System.Convert]::ToBoolean($uniqueAttribute) )
}
if ($summable -eq $true) {
$RequestBody.Add('summable', $summable)
$RequestBody.Add('summable', [System.Convert]::ToBoolean($summable) )
}
if ($regexValidation) {
$RequestBody.Add('regexValidation', $regexValidation)
Expand All @@ -111,6 +111,7 @@ function New-ObjectTypeAttribute {
}

$RequestBody = ConvertTo-Json $RequestBody -Depth 1
$RequestBody
}

process {
Expand Down

0 comments on commit e82c049

Please sign in to comment.