Heatmap Visualization - Event handler in Ui Builder
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have created a heatmap in ui builder .
when i clicked a cell in the heatmap, its not redirecting to the record page.
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);
}
Labels:
- Labels:
-
Risk Management
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
you are not passing a sys_id to your payload, in order the record page to display a record you need to pass a sys_id.
in order to check where exactly the sys_id is stored on the payload of the event and then map it to the fields properties you can simply print the event of the visualization clicked like
console.log("my event", event);
Mark my answer Helpful in case you find it as such.