I can't get data from the New-UDSwitch $EventData Variable

I’m trying to only show a Toast notification if someone switches the switch off, but that variable seems to be empty no matter what.

Code:
New-UDStep -OnLoad {
New-UDTextbox -Id ‘IDNumber’ -Label ‘ID Number’
New-UDSwitch -Checked $true -OnChange { Show-UDToast -Message “Testing – Event Data: --> $EventData <—” -Duration 30000}
} -Label “Step 1”

Behavior:

Am I doing this incorrectly? Thanks in advance!

In v3, I just grab $Body, which is True or False.

New-UDSwitch -OnChange {
    $session:switchValue = $Body
    Show-UDToast -Message "switch is: $session:switchvalue"
    Sync-UDElement -Id 'randomOuter'
}

Cheers,
Steve.

I experience the same in 1.3.1 after the upgrade on Dashboard version 2.9.

Something must have changed during this upgrade / functionallity changed ?
@adam is this a bug?

Hmmm. Yeah. This should be in the upgrade docs but I think I’m also going to fix this so that you don’t actually have to change this. It should continue to set $EventData.

1 Like

Thank you!