Skip to content

Commit 5db6d40

Browse files
fix state
1 parent 5306ca1 commit 5db6d40

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardCloudMessageRecall.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function Invoke-CIPPStandardCloudMessageRecall {
3232
##$Rerun -Type Standard -Tenant $Tenant -Settings $Settings 'CloudMessageRecall'
3333

3434
# Get state value using null-coalescing operator
35-
$state = $Settings.state.value ?? $Settings.state
35+
$state = $Settings.state.value
3636

3737
$CurrentState = (New-ExoRequest -tenantid $Tenant -cmdlet 'Get-OrganizationConfig').MessageRecallEnabled
3838
$WantedState = if ($state -eq 'true') { $true } else { $false }
@@ -41,14 +41,14 @@ function Invoke-CIPPStandardCloudMessageRecall {
4141
if ($Settings.report -eq $true) {
4242
# Default is not set, not set means it's enabled
4343
if ($null -eq $CurrentState ) { $CurrentState = $true }
44-
Set-CIPPStandardsCompareField -FieldName 'standards.CloudMessageRecall' -FieldValue $CurrentState -TenantFilter $Tenant
44+
Set-CIPPStandardsCompareField -FieldName 'standards.CloudMessageRecall' -FieldValue $StateIsCorrect -TenantFilter $Tenant
4545
Add-CIPPBPAField -FieldName 'MessageRecall' -FieldValue $CurrentState -StoreAs bool -Tenant $Tenant
4646
}
4747

4848
# Input validation
4949
if (([string]::IsNullOrWhiteSpace($state) -or $state -eq 'Select a value') -and ($Settings.remediate -eq $true -or $Settings.alert -eq $true)) {
5050
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'MessageRecallEnabled: Invalid state parameter set' -sev Error
51-
Return
51+
return
5252
}
5353

5454
if ($Settings.remediate -eq $true) {

0 commit comments

Comments
 (0)