UI Builder Text Link/Alert Component Events

TFischer
Tera Expert

I'm running into an issue with the OOB Components available and I'm hoping there's a solution that doesn't involve custom component development. I'm trying to create a link that both allows me to use non-link stylized text in addition to the referenced link AND when the link is clicked it opens a new tab in the dashboard, rather than opening a new browser tab.

 

So far, I've looked into two components specifically, Text Link and Alert.

 

The click event action on Text Link component (screenshot below) is configurable, which allows me to use the event intended for opening the link in a workspace tab. However, the label tab accounts for all the text on the component, not allowing me to separate the link from the text (as is possible with the alert component).

TFischer_1-1736779145358.png

 

 

 

With the Alert component (screenshot below) I am able to have text separated from the link, however the link's action is set to the `NOW_ALERT#TEXT_LINK_CLICKED` event, which opens the link in a new browser tab (instead of the workspace tab)

TFischer_0-1736778781546.png

 

1 ACCEPTED SOLUTION

Kevin83
ServiceNow Employee
ServiceNow Employee

I think you can configure the alert component link property like so: (

{
"label": "Link label",
"href": "javascript:void(0)",
"opensWindow": false
})

Screenshot 2025-01-13 at 12.53.29 PM.png
And then in the events choose link to destination to go to the link you want in the workspace:

Screenshot 2025-01-13 at 12.56.12 PM.png

 

 

View solution in original post

9 REPLIES 9

IronPotato
Mega Sage

Hi @TFischer,

 

can you please share the payload that is used for text link clicked event?  

TFischer
Tera Expert

@IronPotato I was using the OOB property value, hoping that using a specific event for the "Text link clicked" handler would override it, but it looks like the OOB payload property is still being called when I click it. Not sure if there is an option here beside to customize.

will adding stylized text component with text link under one container with flex solve your problem about separation? You will add text in stylized test component and right next to it will be text link component.

TFischer
Tera Expert

@IronPotato I think that would definitely fix my styling issue. However, I'm still unsure of how I can get the link to open in a new tab within the workspace instead of navigating to a new page.