Link To Destination/Event Mapping Opening Multiple Tabs

y-allen
Tera Contributor

Hello again.

 

I am working on a workspace for a few executives in our organization. In the body of the home page, I have a list that contains reference fields. The users will need to click on the reference links to view the record and act on it.

 

I am using the "reference link clicked" event mapping with the "link to destination" event handler. I am scripting the event to obtain the table and sys_id of the record to redirect the user to the classic view. However, after entering and saving this configuration, I preview the page and test the redirect, but it opens multiple tabs of the same record, and sometimes, the last page I viewed.

I have deleted and recreated the event mapping and event handler, but then even more pages open.

I have also attempted to view the backend records to see if my deleting the event mapping and event handler are still present in the logic to explain this behavior, but I have not successfully identified the table/record where this information is held.

This is the script I am using in the link to destination even handler:

 

function evaluateEvent({api, event}) {

const table  = event.payload.table;
const sysId = event.payload.sys_id;

const url = (table && sysId)
    ? `/nav_to.do?uri=${encodeURIComponent(`${table}.do?sys_id=${sysId}`)}`
    : null;

return {
    external: url ? { url } : null
};
}
2 REPLIES 2

lauri457
Giga Sage

The event handler mappings are in the page definition [sys_ux_macroponent] and the screen [sys_ux_screen] if I'm not mistaken.

 

What happens if you use another event handler on the same event instead? Say create a client script that just console.logs the event. Will it print multiple times? 

y-allen
Tera Contributor

I did try using a client script, but clicking a reference link did nothing. However, I should be able to console.log results in our testing environment. This isn't allowed in our unclass environment. 

 

Thank you for the information tho. I will make sure to report back my results.