Modify the Service Portal Report Widget to open records in the /sp/?id=ticket way

david_stoner
Kilo Contributor

We're going to be upgrading to Jakarta in a couple weeks, which includes the new "Report" widget for the Service Portal that has people excited. However, in my sandbox instance (which is running Kingston Patch 1), when I open a record or list from a report on the Portal, it loads it in the UI16 view, rather than the Service Portal.

For example, I have a Calendar report on the Service Portal that shows a list of all Change Requests. When I select a Change record from the calendar, it loads it the record with the following URL: ...service-now.com/change_request.do?sys_id=...

What I would like it to do is load the record like it does when I select one of my tickets from the Header Menu -> Requests (URL: ...service-now.com/sp/?id=ticket&table=change_request&sys_id=...). It could even load the form view rather than the ticket view (id=form).

The reason for this is our end users are always redirected to the Service Portal and don't have access to the UI16 view. However, when they select a record from a report, they're redirected to the UI16 view of the ticket, complete with context menu and UI actions. This would provide them with unnecessary access and complication.

Any help/insight would be greatly appreciated.

13 REPLIES 13

lss123
Tera Contributor

Thanks, this is great.  I've implemented your code and I'm noticing that the redirect to the legacy ticket view still happens.  The custom onclick functionality I want also executes, but after that it still redirects to the legacy ticket view.  Do you know how to prevent that redirect?

lss123
Tera Contributor

So it seems like the built-in handler of clicks is the function hc_dataPointClicked, and I'm looking through the HighCharts object to see where that is.  So far I've found two places:

Highcharts.charts[0].userOptions.plotOptions.column.point.events.click
Highcharts.charts[0].options.plotOptions.column.point.events.click


I've looked at hcEvents in a few places within these objects but couldn't see anywhere a click event was defined.  So what I tried is setting the two click events I've listed above to my own function, but this still does not affect the redirect behavior.  Actually, my own functions in this case aren't executing.

I'm on Madrid.  Any insight would be appreciated.

Hi Jack,

I was curious if this is still working for you. I am trying to set this up on a NY instance and running into some issues. I had to do a few tweaks to the code as I was getting undefined $interval and options. It seems to be sort of working where it redirects to the portal list page and then immediate redirects to a navpage. When following the network traffic after clicking on the column, its not even logging the list portal page. So I'm wondering if this is working for anyone still or if anyone has found some other tweaks to get this to work.

Thanks!

Alex

Jack that was some great Sherlock Holmes work there, well done. It's crazy that the widget can be placed on the portal but drills down to the platform, makes no sense eh and I'm surprised there is not portal version now. I think I will either use your solution or use an external chart library that allows me to redirect to wherever.

Cheers

Hi Plissken,

Were you able to achieve this requirement. If so , can you please share me the details how you have achieved it? I am working on requirement where I have to display a pie chart report grouped by categories on Service portal page. When user clicks on any portion of categories , it has to redirect them to 'List'npage with the query.

Regards,

Madhuri