UI Builder: Parameters for UX Events
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 09:31 AM - edited 01-22-2025 09:58 AM
Using the dashboard in UI Builder I'm attempting to open a link in a new tab from a client script which is triggered by a click event.
Component Click -> Client Script -> New Tab Link via UX Event
Thanks to a reply in a different thread from @IronPotato I was able to figure out how to call the event based off the action. However, I'm not sure how to interpret the necessary parameters for the UX event. I was able to track down the event record for "NAV_ITEM_SELECTED" but I haven't found any documentation on how the properties are utilized or what is being referenced with fields and params.
const ref = event.context.item.value;
const payload = {
route: "record", // page name
fields: {
table: ref.table,
sys_id: ref.sys_id
},
params: {
table: ref.table,
sys_id: ref.sys_id
},
redirect: null,
passiveNavigation: null,
title: null,
multiInstField: null,
targetRoute: 'current', // setting target route to current should make sure that you will stay on the same page TAB
external: null,
navigationOptions: null
}
api.emit('NAV_ITEM_SELECTED', payload);
When I look at the url after the event, the table appears to be pulling in correctly, but the sys_id is not.
"8be67a1dbcaa52109e3492dke95d97d33e/edit/false/sub/record/incident/~~undefined~~"
EDIT: So I discovered the convention for params is camel-case and not underscore, so changing sys_id to sysId fixed the undefined issue. Still not sure how the event properties configuration is leveraged.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 10:32 AM
Hi @TFischer ,
from the payload object the "fields" key holds 'required' page parameters. On the other hand key "params" holds optional page parameters.
Can you please take a screenshot of page parameters from settings section of the page you are trying to redirect to?
Example:
Also please add console.log('sys_id', ref.sys_id) first line of your code above and make sure that sys_id is correct at the time of the event execution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 12:05 PM
Hi @IronPotato
Sorry, this might not have been clear in my above statement but I have the redirect to the record page working as intended. My question was more an attempt to understand the UX Event and its properties.
The functionality is working, but it would be an improvement to open a new tab with the specified record within the dashboard rather than navigating the page. I was hoping a different event might accomplish this, but I'm not well versed on their configuration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 10:18 AM - edited 01-23-2025 10:37 AM
Well that's 1 milion $ question :). TBH I would like to know exact functionality of other properties as well. These stuff are very poorly documented and I myself have a thread asking to explain some OOB events that comes with UI builder but nobody seems to have answer. I think not even ServiceNow have the answers :D. Sorry that I couldn't help.