Skip to content

Commit 8b94057

Browse files
JSON convert fix
1 parent 37fc094 commit 8b94057

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-RemoveStandardTemplate.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ function Invoke-RemoveStandardTemplate {
1616
$ID = $Request.Body.ID ?? $Request.Query.ID
1717
try {
1818
$Table = Get-CippTable -tablename 'templates'
19-
$Filter = "PartitionKey eq 'StandardsTemplateV2' and RowKey eq '$ID'"
19+
$Filter = "PartitionKey eq 'StandardsTemplateV2' and GUID eq '$ID'"
2020
$ClearRow = Get-CIPPAzDataTableEntity @Table -Filter $Filter -Property PartitionKey, RowKey, JSON
21-
$TemplateName = (ConvertFrom-Json -InputObject $ClearRow.JSON).templateName
21+
$TemplateName = (ConvertFrom-Json -InputObject $ClearRow.JSON -ErrorAction SilentlyContinue).templateName
2222
Remove-AzDataTableEntity -Force @Table -Entity $ClearRow
2323
$Result = "Removed Standards Template named: '$($TemplateName)' with id: $($ID)"
2424
Write-LogMessage -Headers $Headers -API $APIName -message $Result -Sev Info

0 commit comments

Comments
 (0)