UI Builder: "Link To Destination" and "NAV_ITEM_SELECTED" Events Not Working for New Records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2024 10:12 PM - edited ‎12-22-2024 10:58 PM
Description:
I am working on a UI Builder page where I need to redirect users from a subpage (e.g., "kb_view") back to the record page (e.g., "incident") when a specific action occurs. This works for existing records but not for new records where the sys_id is in the format "-1_u_1".
What I Tried:
- Using "Link To Destination":
Attempted to configure navigation via "Link To Destination," but it does not work for new records. - Using the NAV_ITEM_SELECTED Event:
Below is the script I used:
const redirectPayload = { - redirect: true,
- route: "record",
- fields: {
- table: "incident",
- sysId: api.state.parentTabRecordId, // sys_id of the new record
- },
- };
- // Emit navigation event to redirect the user to the incident record
- api.emit("NAV_ITEM_SELECTED", redirectPayload);
Unfortunately, this also does not work for new records.
Goal:
I need a reliable way to redirect users from the "kb_view" subpage back to the "record" page, regardless of whether the sys_id belongs to an existing record or a new record (e.g., "-1_u_1").
Questions:
- Is there a specific configuration or workaround to handle navigation for new records in UI Builder?
- Does NAV_ITEM_SELECTED support this use case, and if not, what alternative approach should I use?
- How can I ensure compatibility for both existing and new records when using navigation events in UX client scripts?
Any insights or suggestions would be greatly appreciated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2024 06:37 AM
Routing the user to a record that is already open in a tab should always just refocus that tab instead of opening a new tab. If there is already a tab open for a new record you should be able to just refocus that tab by removing the _u_1 from the url.
Basically, the way the routing works for the workspace app shell is that if you're opening a url that already exists in a tab it just takes you to that tab, if the url doesn't already exist it opens a new tab. For new records, the _u_1, _u_2 is appended to the -1 sys_id value in order to make the url unique and force new records to open in a new tab.
I'm not exactly sure if what you're trying to do is possible, but hopefully this helps explain things a bit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2024 09:09 AM - edited ‎12-23-2024 08:36 PM
I am working on configuring a button on the KB_View page (when a knowledge article is opened via Agent Assist in full view). The goal is to set specific fields on the Incident form, similar to how a template works. Here's the current situation:
Current Approach:
- I am passing the sys_id of the template through the URL using "Link to Destination Record."
- On the record page, I created an event handler to parse the URL, retrieve the template ID, and apply it to the record page using the "on page property change" event.
Issues Encountered:
- This approach works only for existing records (those with a sys_id).
- When trying to redirect to create a new Incident record, it opens a new tab in the workspace with a "Record Not Found" message.
Questions:
- How can I establish client-side communication between the KB_View page (knowledge sub-page) and the controller on the Incident record page to pass data or interact dynamically?
- For redirecting to a new record, how can I avoid the "Record Not Found" error and prefill the form fields?
- Is there a way to refocus an already open tab (even for new records) using a UX client script?
- How can I implement this tab-refocusing behavior through a UX client script, especially for new records?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2024 11:17 AM - edited ‎12-26-2024 05:29 AM
Any suggestions or thoughts? @Brad Tilton @Ashley Snyder
For existing records, the link works correctly as the record page includes the required parameters: sys_id and table name. However, for new records, I have tried the following approaches:
- Using "-1": This opens the record in a new tab, which is not the desired behavior.
- Using "-1_u_1": This results in a "Record not found" error.
Could you please clarify:
- How should the parameters be configured to handle new records correctly?
- Is there an alternative approach or parameter for maintaining the intended functionality?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2024 07:08 AM
If you're opening a new record it's going to open in a new tab unless you already had a tab open with a -1 route. We don't really have functionality that lets you target specific tabs/routes. Generally, workspace is going to repoen an existing page in the existing tab, or open a new route in a new tab. I would not try to change the way that works or introduce a new paradigm.
Here's a little more on how the -1_uid_1 functionality works: https://www.dylanlindgren.com/2023/12/21/creating-multiple-instances-of-the-same-route-in-ui-builder...