Refreshing data in a table in Pages

I am new to PowerShell Universal and trying to use pages to build out a basic interface that can create DNS records and display them. My page has a form and a table. The form takes in a user text input and runs a script that generates DNS records based off the text input. The table runs a script that pulls in a subset of current DNS records that the user could use to confirm existing entries and the new entries created by the from.

The from works, I can create new DNS entries but refreshing the table to pull in the new data has been problematic. I figured out the table does not run the actual script but just pulls output from the last time the script was ran as a job. My hope was to figure out a way to allow the user to manually run the script and refresh the table by using the optional refresh button that you can enable in the table.

I figured out that if I create separate button and set that button to execute the same script referenced by the table, that I can at least force a job to run the script. But the refresh button on the table will not pull in this new jobs data and continues to display the prior data. If I refresh the browser after clicking the button it will pull the latest jobs data into the table.

Guessing this is where my lack of understanding how sessions work is getting me but I would like to see if it is possible in pages to allow the form to update the table after it has executed or allow the user to click refresh on the table to force run the script and pull in the latest job data. Using an additional button and hitting F5 is not intuitive for a user. If I need to do this as a dashboard that is fine, just wanted to see if it could be done in pages first as a POC so I could sell it to the bosses on ease of use so we can justify getting license.

@LazyAutomationAdmin
you need to use new-uddynamic and a button refresh so when you hit the button it will refresh the data

check below example

Thank you @wsl2001, this solution looks like it would work if I was building a dashboard, correct or can I use this somehow in Pages like a custom UI object?

Hi,
I have the same question - I have simple page (not dashboard) that connects to SQL to get some data. I implemented the refresh button which runs the script and should refresh the table component on the page but it doesn’t refresh unless I reload the page.

To reply to myself - don’t use script as a datasource but use endpoint then page refreshes correctly

Thanks for posting that @bothari! I was avoiding the APIs because I thought there would be a big learning curve vs just running a script, but I took a look after seeing your post and was able to covert over my script to an endpoint in like 10 minuets. Amazing!

1 Like