Opening multiple records/tabs from a button in ui builder / workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 12:37 AM
Hello everyone I'm investigating 2 possibilities:
- Have a button upon multiple selection of related list records, that opens those same records in different tabs in the workspace. (When users click on a related list, it opens the record right away and redirects to the record tab, users might want the same behavior as when you click CTRL + Record in a list, which just adds a tab on top and the user is not redirected right away to that tab), this is what I want to accomplish.
- Have a custom button on a custom page in ui builder that opens X records, but emitting X number of events. WIthin UI builder I can emit events that create a tab for a given record without redirecting, but I'm not able to emit multiple events for some reason, see below.
For 1, I created a related list action (Now Experience Framework -> Declarative Actions -> Related List actions :
Here I tried the supposed to be most simple solution by creating a FOR loop and using
g_aw.openRecord
This works, but only for 1 record, it never works within a for loop and I tried in multiple SN versions.
On top of this I've tried other different ways, using open(), top.window.open, this.open, all of these open the url but on new browser tabs, not within the workspace.
So , does anyone have idea how to get this one working ? Is it even possible as a client / server script? I'm thinking on going the UXF Client Action way, but for that my option 2 must work.
For 2, I just created a simple button for testing purposes :
Then on that client script I have something like:
api.emit("NAV_ITEM_SELECTED", {
route: 'record',
fields: {
table: "incident",
sysId: "7a8e5f1493b10210f62d77f08bba1044"
},
params: null,
redirect: null,
passiveNavigation: true,
title: "An Incident",
multiInstField: "sysId",
targetRoute: "current",
external: null
});
api.emit("NAV_ITEM_SELECTED", {
route: 'record',
fields: {
table: "incident",
sysId: "17db1f5093b10210f62d77f08bba100f"
},
params: null,
redirect: null,
passiveNavigation: true,
title: "An Incident",
multiInstField: "sysId",
targetRoute: "current",
external: null
});This also only works on the first record. So even if I go the UXF Client Action way, at the moment I cannot trigger multiple tabs at the same time, even using passiveNavigation: true.
So if anyone has an idea how to get it to work let me know 😄
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2024 11:03 PM
Interesting way to think about it, but indeed a bit extreme for what I need. My question is also how does the list component do it? Because when you are on the list component and you do ctrl + click on a record, it opens 1 or multiple tabs for the record (if you do it multiple times),which are basically sleeping until you click on them, so any idea of what type of event is triggered there?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I ran into the same problem. The root cause is that g_aw isn't available inside a Declarative Action triggered from a list context — it's simply undefined there, regardless of how you call it.
What ended up working was using top.open() combined with GlideAjax to call a Script Include that resolves each record's URL server-side, then opens them in sequence. Not the cleanest approach, but it's the only one that reliably works across Xanadu and Zurich.
I wrote about this in detail if it's useful (article is in Spanish, but Google Translate handles it well): https://breaking-trail.vercel.app/articulos/workspaces/abrir-multiples-registros-desde-da-lista
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello Henalu, nice one, I will try it out.
