UI Builder List Component links not working

Alan S
Tera Contributor

Hello,

 

I am new to UI Builder, and I am adding a "List" component to an existing home page. I was able to add the list, configure the table/filter, and set up visibility logic.

 

The list itself is working as expected, but I tested the links to the actual records/reference fields. Nothing happens when I click them.

 

Did I miss something in my initial configuration? I have not done changed anything with events because I didn't want to customize any basic list functionality.

 

AlanS_0-1666880509803.png

 

7 REPLIES 7

Simon38
Tera Contributor

I ran into the same issue. If anyone is still looking for a solution, here is how I solved it. Basically I checked the configuration of the "List Default" Page and copied the config, which worked like a charm.

 

  • On the Page where your List component is, go to the bottom left and add a new client script. Give the script a name and add the "recordRoutesMapping" client script include:

Simon38_0-1728402499554.png

 

  • Paste the following code to the script and close the client script section

 

function handler({
    api,
    helpers,
    event,
    imports
}) {
    const {
        routeMapping,
        buildDefaultRoutePayload
    } = imports["global.recordRoutesMapping"]();

    var route = 'record';
    var targetRoute = '';
    const defaultRoutePayload = buildDefaultRoutePayload(route, targetRoute, event);
    
    const routeMap = api.data.dynamic_routing_list.routeMap;
    const payload = routeMapping(routeMap, defaultRoutePayload, event);

    // If a table name passed into trueupTable matches the existing table
    // refresh trueup DR to get real table name; otherwise use existing.
    if(api.state.routeParentTables && api.state.routeParentTables.split(',').find(table => table === payload.fields.table)) {
        api.setState('navigationPayload', payload); 
        api.data.resolve_route_parent_tables.refresh(); 
    } else { 
        api.emit('NAV_ITEM_SELECTED', payload); 
    } 

}​

 

  • Select your list component and go to the "Events" tab
  • Click "+Add event mapping"
  • Select "Reference link clicked"
  • Select the client script you've just created and click "Add"

    Simon38_6-1728402973890.png

Now your refence links in the list should work. Hope this helps. @Alan S if this solved the issue please mark as solution.

 

Cheers

Simon

 

 

 

 

 

 

 

RahmanM
Tera Contributor

Hi @Simon38, following your comment above. When clicking the Reference link on the grid I have added some debug console logs and I can see that the new Client Script is called. But there is an error in console "sn-canvas-screens.resolver.js:225 Error, route macroponents should be an array". The navigation also does not work and the UI Builder shows a blank page with this error "The page you are looking for could not be found".

 

So not sure what is wrong? Also, I still don't understand why this should not be out of the box anyways?

 

rahman

Simon38
Tera Contributor

Hi @RahmanM which build are you currently running on? We ran on Vancouver when I implemented this, we updated to Xanadu in the meantime and it still works fine.

 

Are you using the standard "List" component or maybe another one? If you post some screenshots of your configuration (list, clients script etc.) I may be able to dig into it some more.

 

Regarding the out of the box statement, to be honest this is my whole experience with Servicenow ^^ Pretty much anything is possible, but you need a masters degree to achieve it.

 

Cheers

Simon