The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Heatmap Visualization - Event handler in Ui Builder

dhivyalaksh
Tera Contributor

I have created a heatmap in ui builder .

when i clicked a cell in the heatmap, its not redirecting to the record page.

dhivyalaksh_0-1758123913217.png

 this the script i have used

/**
 * @Param {params} params
 * @Param {api} params.api
 * @Param {any} params.event
 * @Param {any} params.imports
 * @Param {ApiHelpers} params.helpers
 */

async function handler({
    api,
    event,
    helpers,
    imports
}) {
    const title = event.payload.title;
    var queryObj = event.payload.params.url;
    // converting the following query
    // "sn_risk_risk_list.do?sysparm_query=impact%3De1d1c772d7030200bbc783e80e610364%5Elikelihood%3Dfc318772d7030200bbc783e80e6103d8"
    // to
    // impact=e1d1c772d7030200bbc783e80e610364^likelihood=fc318772d7030200bbc783e80e6103d8
    queryObj = queryObj.split("sysparm_query=").pop();
    queryObj = queryObj.replaceAll("%3D", "=");
    queryObj = queryObj.replaceAll("%5E", "^");
   
    const listTitle = await helpers.translate("Risks");
    queryObj = queryObj + "^state!=retired";
    const payload = {
        fields: {
            "table": "sn_risk_risk"
        },
        params: {
            "query": queryObj,
            "listTitle": listTitle
        },
        title,
        route: "simplelist"


    };
    api.emit("NAV_ITEM_SELECTED", payload);
}
0 REPLIES 0