I have a table, in that table each row has a button calling a Show-Udmodal.
The code for the button and Modal is added through a Select Expression on a get-ADUser, and basically i’m looking for a way to have a modal display info based on the user in the row where the button is clicked.
I’ve tried something like below, but once displayed the Header and card title is blank.
I am trying to do something similar but cannot get the data to pass to the UDCard. I am using the results from a SQL query and passing the data to a UDgrid. The grid has a UDButton (Details). When I click on the button the UDCard displays but instead of the 2 lines of info (data and contact) I get Cannot index into a null array. Not sure how I need to pass the data down to the card. Here’s my code:
Hey @adegutis thank you for the detailed example it made it easy for me to repro!- I think I see what is going on here…
For this section: $Data | Select-Object $Columns | ForEach-Object {
When you Select-Object Columns your ARE NOT bringing in .DateAdded, $.Contact. What this means is that when you are trying to pass this arguments into your elements they are null. This is causing the error you are seeing.
One Tip here- When I start my New-UDEndpoint for my click I like to assign my arugments to variables, this way you WON’T get the big nasty NULL error, your values will just be null… maybe not the most efficient PowerShell usage but can save some confusion…
The second issue is that down in your New-UDelements you are using Argumentlists and in the case of the Contact you are specifying ArguementList Item 1 (which is the second item) but you only passed in one item.
Soo…
I was able to copy paste your script and insert fake data and got it to work quite nicely by doing the following: