How to Redirect to Another Page with Selected Data from Vertical Bar Chart in ServiceNow UI Builder?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2025 09:44 PM
Hello Community,
I am working on a drill-down page in ServiceNow UI Builder that includes a vertical bar chart. The chart has the following configuration:
- X-axis: Product name
- Y-axis: Account name
I need to implement a feature where clicking on a bar (representing a product) redirects the user to another page (e.g., "View page"). The "View page" requires one mandatory parameter and three optional parameters.
My requirements are:
- When a user clicks on a product in the bar chart, the selected product name should be passed to the URL.
- The user should be redirected to the "View page" with the selected product name as a parameter.
Could you please guide me on how to:
- Pass the selected product name to the URL.
- Redirect to another page with the selected data.
Any examples or detailed steps would be greatly appreciated.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2025 02:43 AM
Hi @MansoorM,
1. create client script with this code: console.log('visualization clicked', event.payload);
2. hang that client script on visualization component and it's "Visualization Clicked" event.
3. save the changes and refresh your page.
4. open browser's developer tools and click on the visualization chart and observe the payload.
5. access your data and store them in variables e.g:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2025 11:38 PM
console.log('visualization clicked', event.payload);
for the above log am getting undefined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2025 11:41 PM
change it to just event without payload so console.log('visualization clicked', event) and observe the object
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 12:28 AM
Got this in console log in payload chart type getting undefined