New-UdTable -showrefresh not refreshing the data from sql

Product: PowerShell Universal
Version: 4.5.3

How come when I click the refresh icon in the table, it doesn’t refresh my data? The only way to get new data is when I refresh the page.

New-UDGrid -Container -Content {
    New-UDCard -Title 'Find the next available SAM' -Content {
        New-UDForm -Content {
            New-UDCheckbox -Label 'Place SamAccountName (Login ID) on hold' -Id 'HoldAccount' -Checked $true 
            New-UDTextbox -Label "ServiceNow RITM Number" -Id "SNRITMNumber"
        } -OnSubmit {
            try {
                $SNRITMNumber = $EventData.SNRITMNumber
                $HoldAccount = $EventData.HoldAccount

                if ($HoldAccount) {
                    $Job = Invoke-PSUScript -Script "ActiveDirectory\User\Get-NewSAM.ps1" -SNRITMNumber $SNRITMNumber | Wait-PSUJob
                }
                else {
                    $Job = Invoke-PSUScript -Script "ActiveDirectory\User\Get-NewSAM.ps1" -SNRITMNumber $SNRITMNumber -DontHold | Wait-PSUJob
                }

                 # Sync the table to reload with new data
                Sync-UDElement -Id 'table' 
            }
            catch {
                Show-UDToast -Message "ERROR: $PSItem" -Duration 50000
            }
        } 
        New-UDElement -Id 'results' -Tag 'div'
    }
}

$Columns = @(
    New-UDTableColumn -Property DateCreated -Title "Date Created" -ShowFilter -ShowSort -IncludeInSearch -IncludeInExport -DefaultSortColumn
    New-UDTableColumn -Property SamAccountName -Title "SamAccountName" -ShowFilter -ShowSort -IncludeInSearch -IncludeInExport 
    New-UDTableColumn -Property SNRITMNumber -Title "SNRITMNumber" -ShowFilter -IncludeInExport -ShowSort 
)

# Define the parameters in a hashtable\
$Data = Read-SqlTableData @SqlParams -ErrorAction SilentlyContinue


New-UDDynamic -Id 'table' -Content {
    New-UDTable -id "Users" -Columns $Columns -ShowRefresh -LoadData {
        
        foreach ($Filter in $EventData.Filters) {
            $Data = $UsersInTable | Where-Object -Property $Filter.Id -Match -Value $Filter.Value
        }

        $TotalCount = $Data.Count 

        if (-not [string]::IsNullOrEmpty($EventData.OrderBy.Field)) {
            $Descending = $EventData.OrderDirection -ne 'desc'
            $Data = $Data | Sort-Object -Property ($EventData.orderBy.Field) -Descending:$Descending
        }

        $Data = $Data | Select-Object -First $EventData.PageSize -Skip ($EventData.Page * $EventData.PageSize)
        $Data | Out-UDTableData -Page $EventData.Page -TotalCount $TotalCount -Properties $EventData.Properties 

    } -ShowFilter -ShowSort -ShowPagination -ShowExport -PageSize 10
}

Try to put the

$Data = Read-SqlTableData @SqlParams -ErrorAction SilentlyContinue

also under New-UDDynamic, otherwise it probably won’t get refreshed with Sync-UDElement

LOL that worked. Wish It was more obvious. Thank you for responding and your help