Is there a way to re-submit a Form when used on a Dashboard from the Script

Hello all,

I am relatively new to Powershell Universal. I have started work on creating a tool for my users to lookup Users and Groups against AD. I have most of the features / Functionality I want all set up and it works well! Right now, if you search for a group or user, it generates tables and lists with specific user/ group information. I also have buttons rendering where applicable in Table Columns. For example, a user’s manager might have a button to look up the manager in AD. Right now, I have it populating the textbox in the form, but the user has to manually click ‘Submit’, then the tables recalculate. This works fine, but I feel the experience would be more slick if I could resubmit the form from the code since the OnSubmit block is an endpoint from what I can tell. In my mind if there was a .onclick() method I could theoretically leverage that within the button OnClick() action. Hopefully what i am looking for makes sense! If anyone has any ideas on how to implement this (if it is possible), I would appreciate it!

Product: PowerShell Universal
Version: 2.0.2```

Can you share a little bit of your script? I kind of understand what you’re trying to do but having some script would be helpful.

Hey Adam, Sure thing! I’ll grab a snippet of the section. I can attach more if needed. So i Have a form that has a checkbox, and a text field. Then On-submit, the script block queries AD. The first check is if the search was unique. If so, if populates the. If there are multiple users or groups found, I Have it creating a table of the users or groups. The account name collumn is rendered to include a button. When you click the button, it clears the value of the text box, and sets it to the value of the button. Ideally the next step would be to resubmit the form with the updated data. I tried to condense the code to the “relevant portion” , so in the following code block, you should see the form, and the blocks used to build the columns and table. I have it wrapped in a grid as well. I Ommited the data gather portion for brevity. Sorry about the formatting.

`New-UDForm -ID ‘Form_ADLookup’ -content {
New-UDRow -Columns {
New-UDColumn -SmallSize 12 -LargeSize 12 -content{
New-UDTextBox -ID “Username” -Label “Enter Name or ID” #Get username
}

                    New-UDColumn -SmallSize 6 -LargeSize 6 -content{
                        New-UDcheckbox -ID "ExtendedATT"  -Label "Extended Attributes"  #Add extended values
                    }
                    
                } 
                
            } -OnSubmit {

$Columns_ObjInfotmp = @(

                            New-UDTableColumn -property "Name" -Title "AccountName" -Render {

                                if ($eventdata.ObjectClass -eq 'group')

                                {

                                    New-UDButton -ID "BTN_$($EventData.Name)" -icon (New-UDIcon -icon 'users' -size 'lg') -Text "$($eventdata.Name)" -OnClick {

                                        Set-UDElement -id Username -Properties @{value = ""}

                                        Set-UDElement -id Username -properties @{Value = $EventData.name}

                                        Clear-UDElement -ID "Results"

                                        Sync-UDelement -ID 'Form'

                                    }

                                } 

                                elseif ($eventdata.ObjectClass -eq 'user')    

                                {

                                    New-UDButton -ID "BTN_$($EventData.Name)" -icon (New-UDIcon -icon 'id_badge' -size 'lg') -Text "$($eventdata.Name)" -OnClick {

                                        Set-UDElement -id Username -Properties @{value = ""}

                                        Set-UDElement -id Username -properties @{Value = $EventData.name}

                                        Clear-UDElement -ID "Results"

                                        Sync-UDelement -ID 'Form'

                                    } 

                                }

                            }

                                New-UDTableColumn -property "DisplayName" -Title "DisplayName"

                                New-UDTableColumn -property "EmployeeID" -Title "EmployeeID"

                                New-UDTableColumn -property "Title" -Title "Title"

                                New-UDTableColumn -property "Mail" -Title "Email"

                                New-UDTableColumn -property "Department" -Title "Department"

                                New-UDTableColumn -property "ObJectClass" -Title "TypeOfObject"

                        )       

                        #Create Grid

                        New-UDGrid -Container -content {

                                    

                            #User Information

                                    

                            New-UDGrid -item -LargeSize 12 -content{

                                #Display the Generic user info

                                New-UDcard -Title "Multiple Users Found" -content {

                                    New-UDTable -Data $Data_MultiObject -Columns $Columns_ObjInfotmp -Sort -Paging 

                                    }

                                }

                            }

                        

                    }`