I am trying to port automation front ends over to UD. Specifically, I’m building web forms to get details of a user request, trigger an automation, and return results.
UDInput is the obvious candidate, but the UDInputFields don’t have all of the required functionality. Other UD object have better functionality, but I don’t know how to reference them.
For example, the “select” UDInputField does not allow for multiple selections. UDSelect allows for multiple selections, but how do I reference the selected values? I read one forum topic where Adam explained that to use the value of UDSelect, I should add -OnChange code that sets a $Session scope variable. But how do I do that?
And then when the user clicks my “Execute” UDButton, after the automation is complete, how do I replace the form with the results? That is, how do I have UDInputAction like behavior if I’m not using an UDInput?
Similarly, next to that button, I need a “Cancel” button that takes the user to a specific page, and sometimes other buttons that take the user to other specific pages. How do I create buttons that act like links?
And using -OnChange to set a $Session variable may work for UDSelect, but what about something like UDTextBox, which does not have any event parameters?
So the idea would be to create all your controls and then you can use Get-UDElement in your button’s OnClick handler to get the value of the elements there.
I got Get-UDElement working in UniversalDashboard.Community v2.2, but the same code does not work in UniveralDashboard v2.2.
In UD.Community, Get-UDElement works in an -OnClick scriptblock, but not in an -Endpoint scripblock. Is that expected?
And I had another couple questions in my original post:
And then when the user clicks my “Execute” UDButton, after the automation is complete, how do I replace the form with the results? That is, how do I have UDInputAction like behavior if I’m not using an UDInput?
Similarly, next to that button, I need a “Cancel” button that takes the user to a specific page, and sometimes other buttons that take the user to other specific pages. How do I create buttons that act like links?
Restarting the machine fixed both the Session variable issue and the Get-UDElement not working in an endpoint issue. (Restarting PowerShell had been insufficient.)
Both seem to be working normally now.
(I’ll re-ask the remaining questions in a different thread.)