We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

"Link to destination" is not displayed in the event handler in UI Builder

Hirokazu Dekiok
Kilo Guru

In Platform Analytics, I chose to create a dashboard with Technical editor and created a dashboard using UI Builder.
In the list component, set the "Reference link clicked" event and use the "Link to destination" event handler,
I wanted to write a script like the example below to implement a function that transitions to an external link.

 

/**
 * @Param {params} params
 * @Param {api} params.api
 * @Param {any} params.event
 */
function evaluateEvent({
    api,
    event
}) {

    const payload = event.payload;
    const sys_id = payload.row.sys_id.value;
    const table = payload.table;

    return {
        route: null,
        fields: null,
        params: null,
        redirect: null,
        passiveNavigation: null,
        title: null,
        multiInstField: null,
        targetRoute: null,
        external: {
            url: "/now/nav/ui/classic/params/target/" + table + ".do%3Fsys_id%3D" + sys_id
        }
    };
}

 

However, as shown in the image below, "Link to destination" was not displayed in the event handler options and could not be used.
Therefore, I would like to ask you the following two questions.

 

Q1:Please let me know if there is a way to enable the use of the "Link to destination" event handler.
Q2:Please let me know if there is any other way to transition to a similar external link instead of using "Link to destination".

 

I tried customizing only the external part of the script using the "Advanced dashboards - Redirect" event handler, but it did not work.

 

Everyone, we ask for your cooperation.

nowcomu.jpg

 

1 REPLY 1

Jared Kramer
Tera Expert

I was able to use the "Advanced dashboards - Redirect" to work with the following script:

function evaluateEvent({api, event}) {
	var table = event.payload.table;
	var sys_id = event.payload.sys_id;
	
	var url = table + '.do?sys_id=' + sys_id;

	return {
		context: null,
		route: null,
		fields: null,
		params: null,
		title: null,
		external: url
	};
}

JaredKramer_0-1764622548968.png