Open new Browser tab via button in UDTable

I am attempting to open a new tab in current browser via a button in UDTable. Button displays but massive errors when clicked. Think my method { [System.Diagnostics.Process]::Start(“$href”) } is wrong for this situation but do not have a better idea. Can anyone point me in the right direction?

$ProcoreJobs = New-UDPage -Name "Closed Jobs"  -Content {
    New-UDDynamic -Id 'Procore' -Content {
        Get-AccessToken -AuthUrl $AuthUrl -GrantType $GrantType -ClientId $ClientId -ClientSecret $ClientSecret
        $Result = Get-ClosedProcoreJobs

        $Columns = @(
            New-UDTableColumn -Title 'Job Number' -IncludeInSearch -Property 'project_number'
            New-UDTableColumn -Title 'Project Name' -IncludeInSearch -Property 'Name'
            New-UDTableColumn -Title 'Date Closed' -Property 'DateClosed'
            New-UDTableColumn -Title 'View' -Property 'Active' -Render {
                $href = '--start-fullscreen "' + $result.href + '"'
                New-UDButton -icon (New-UDIcon -icon 'Chrome') -size "large" -Style @{ backgroundColor = '#00CC33' } -OnClick {
                    [System.Diagnostics.Process]::Start("$href") 
                }
            }
        )
        
        New-UDTable -Title 'Procore Closed Jobs' -Data $Result -Columns $Columns -dense -showpagination -pagesize 10 -ShowSearch -ShowSort
    } -AutoRefresh -AutoRefreshInterval 600 -loadingcomponent { 
        New-UDCenter -Content {
            New-UDTypography -Text 'Loading Projects' -Variant h5
            New-UDProgress -Circular -size "large" 
        }
    }  
}

You need to run this from the browser rather than the server. Try this:

Invoke-UDRedirect $href -OpenNewWindow

This worked, however, the switch was OpenInNewWindow.

1 Like