Creating a Link in a UDGrid

Hello,

I’m working on a dashboard that I’d like to have a main page that would list information on servers we have in our environment. I have a UDGrid that will display the amount of errors a server has and I have a separate page that has a udinput that you can enter in the server name to get a more detailed breakdown of that server. What I would like to do is to have the Server Error UDGrid that is on a different page, have a link for each server in the grid that would then direct it to the more detailed page and automatically have the input sent to the UDInput. Is it possible to have a link direct to a UDPage that then supplies the UDInput needed for that page?

Hi @TylerW44,

You’re looking for dynamic pages:
https://docs.universaldashboard.io/components/pages#dynamic-pages

give me a shout if you need some code examples to get you started :slight_smile:

When building the object to be passed basically do this to column wanting to have a link.

$_.Server = (New-UDLink -Text $_.Server -Url $info.UDLink)

$info.UDLink is a reference to a dynamic page you built.

Thank you @BoSen29 and @cadayton . I’ll give it a go tonight. Examples are always good if you’re willing to share.

I was able to get it to work and it’s great. Thank you both1

1 Like

step 1:
create a dynamic page that accepts the server name or check variable

e.g

$pages += New-UDPage -Url “/dynamic/:Name” -Endpoint { #/dynamic will be your page path and :Name will be your variable that is passed on from your main dashboard table

param($Name) #remember to ad this, this is what tell UD that :Name is a parameter

Step 2:
include a button or clickable link somewhere in your table/grid to invoke a redirect to your dynamic page.

your table should already be piped into a pscustomobject. i use this in my link pscustomobject

> Link = New-UDButton -Icon eye -OnClick { Invoke-UDRedirect -Url (Get-UDDynamicLink($_.itemid)) } #itemid is what you will be giving your dynamic page as a variable... so for example the server name or item id.

you will want to add a path to your dynamic pages, i use functions for this

function Get-UDDynamicLink($id){return "dynamic\\$id"}

if you have set up your columns correctly you should have a eye button that will direct you a new page that will use the last part of the url as a value for variables, which you can then use to display filtered data on the dynamic page.