First Time Linking Script to Dashboard. Experiencing Issues

Hey everyone I am new to PowerShell Universal and am creating a dashboard for Active Directory auditing purposes. I’ve written a script that obtains an individual AD user’s MemberOf property and outputs the Name and Description property of each group the user is a part of.

I am trying to invoke this script when a person hits the submit button on the dashboard.

New-UDCard -Title "Group Membership Lookup" -TitleAlignment "Center" -Content{
                #Creating a new form within the UDCard.  The form will hold specific fields that can be modified.
                New-UDForm -Content{
                    #New textbox inside of the form.  User will have the ability to enter a username here.
                    New-UDTextbox -ID "SamAccountName" -Label "Username"
                #When the submit button is clicked...
                }-OnSubmit{
                    #Converts a JavaScript Object Notation (JSON) formatted string to a custom PSCustomObject object that has a property for each field in the JSON string.
                    $User = ConvertFrom-Json $Body
                    Try{
                        **$Ouput = Invoke-PSUScript -Script '.\Get-ADUserGroups.ps1' -User $User -Integrated -Wait**
                        Sync-UDElement -ID "GroupTable"
                    }
                    Catch{
                        #Toast message displaying exception error
                        Show-UDToast -Message $_
                    }
                }
                #Allows you to define a dynamic region.  You may want to reload a section of a page rather than the whole page itself. This is when you will want to use dynamic regions.
                New-UDDynamic -ID "GroupTable" -Content{
                        #Foreach Group, create a PSCustomObject with GroupName and Description property.  Store in $TableData.
                        #Column Data that will be used to populate the UDTable. Utilzing the PSCustomObject properties.
                        $Columns = @(
                            New-UDTableColumn -Property "GroupName" -ShowFilter
                            New-UDTableColumn -Property "Description" -ShowFilter
                        )
                        #Create new table.  Data will be from $TableData and the columns will be appropriately populated with the values in the properties defined above.
                        New-UDTable -Id 'Group Membership' -Data $TableData -Columns $Columns -Sort -Paging -PageSize 10
                    
                }
            }

And here is my script,

Import-Module ActiveDirectory
<#
    .SYNOPSIS
        Each group a user is in, create a PSCustomObject for that group with specific properties.
        
    .DESCRIPTION
        Passing in the $User Object and returning all of the associated group names of the object
    #>
param (
    [Parameter(Mandatory)]
    $User
)
$Groups = Get-ADUser -Identity $User.SamAccountName -Properties MemberOf | Select-Object -ExpandProperty MemberOf | Foreach-Object {Get-ADGroup -Identity $_ -Properties Description | Select-Object Name, Description}

Foreach($Group in $Groups){
    [PSCustomObject]@{
        GroupName   = $Group.Name
        Description = $Group.Description
    }
}

When I hit the submit button my dashboard I am presented with the Toast message of

Cannot Retrieve the dynamic parameters for the cmdlet. Failedtoquery.Notfound

I think it may be how I am trying to pass my $User parameter into my script with this, $Ouput = Invoke-PSUScript -Script '.\Get-ADUserGroups.ps1' -User $User -Integrated -Wait

Would anybody be able to provide any insight into this issue I am having? Thanks so much for taking the time to read through my issue!

@NHFilm

to get the value entered in the textbox you need to use

(Get-UDElement -Id "SamAccountName").Value

OR since you are using forms

$User = $($EventData.SamAccountName)

Ah! Thank you so much. This helped a ton.