Fun with Highcharts, Part V

“It’s always something.”
Roseanne Roseannadanna

I decided to enhance my workload chart by adding the ability click on a bar or point on the backlog line and bring up a list of all of the tasks represented by that data on the chart. Highcharts makes that super simple to do, so I went out and grabbed some example code off of the Interwebs and added this to my workload chart template:

plotOptions: {
        series: {
            cursor: 'pointer',
            point: {
                events: {
                    click: function () {
                        alert('Category: ' + this.category + ', value: ' + this.y);
                    }
                }
            }
        }
    },

That was enough to prove that everything worked, after which I was going to modify the click function to navigate to a Data Table page with the appropriate filter to list out all of the tasks represented by the data point selected. Unfortunately, when I fired it up to test it out, nothing happened when I clicked on a bar or a point along the line. The cursor did change to a pointer, so that part was definitely working, but no alerts popped up no matter where I clicked. I hate it when that happens!

It took me a little while to figure this out, but after a little bit of digging around I finally reached the heart of the issue: I built the chart object on the server side, and when it was transferred to the client side where it was to be used, it was converted to a JSON string somewhere along the lines in the background Ajax process, and that conversion removed the function (JSON only preserves data; any functions are lost in translation). While it was nice to finally understand the root of the problem, the implication was that my whole way of going about this was pretty much invalidated. I can’t build a chart object on the server side and then pass it to the client side and retain any functions that might be a part of the object. The chart object will need be generated on the client side where it will be used. That means a total redesign of the entire concept.

Well, I guess that guy Charles Lauller knew what he was talking about. Time to start over with a blank sheet of paper

Well, that doesn’t work

“I have not failed. I have just found 10,000 ways that won’t work!”
Thomas Edison

It seemed like a fairly straightforward request. My typical response to these types of queries is, “Sure, I can do that,” without really looking into things to see what it might take or if it is even possible. But seriously, how hard could it be?

On the ServiceNow Incident form, there is an option on a drop-down menu labeled Email:

Clicking on this menu option brings up a form that allows you to compose and send an email to the person who reported the Incident. They liked this feature, but they wanted to expand on the concept. Would it be possible to put a series of check-boxes somewhere across the top to select one or more of Caller, Assignment Group, or Assignee?

Sure, no problem.

As soon as I got back to my computer, I started digging around to find the UI Page or Portal Page behind that form. Unfortunately, there is no UI Page or Portal Page behind that form. From what I can tell, unlike most forms and pages in this tool, this one is an integral part of the product and does not have its parts and pieces housed in the system database. That seemed unfortunate, but then I discovered Email Client Templates. There were some possibilities there, but still not what I was looking for. I ran down a few other promising-looking rabbit holes that all terminated in fairly substantial brick walls at the end, and then decided to step back and taker a broader view of things.

If I couldn’t put the check-boxes on the form itself, what if I created an intermediate form that I could control completely, and then passed the user’s selections to the email form via URL parameters? Basically, all I had to do was find out where the existing menu item led, replace that destination with my own intermediate form, and then have my form do whatever the original menu item did, but with the addition of the user’s choices. Let’s go find that menu definition and grab the current pointer and replace it with a new one … how hard could that be?

Well, as it turns out, that menu is not based on data stored in the system database as far as I can tell. I may have missed it somehow, but I dug around quite a bit and couldn’t find any place where that list of items could be modified in any way. It might be in there somewhere, but I certainly couldn’t find it.

So, maybe I spoke a little too soon when I said that I could do this. Still, there has got to be a way