Scripting a UI Page with jelly: Using a glideAggregate in the Clientscript

Fabian Kunzke
Kilo Sage
Kilo Sage

Hello,

I am currently trying to code a UI Page which is using Highcharts. That UI Page is called via a Widget, which then is placed in a pa dashboard. Now this is so far working fine. But i have run into the following problem:

Using a GlideRecord to gather the needed information for the chart is working totally fine within the client script. But, as soon as i try to use a GlideAggregate it does not work. At this point i simplified it so much, that i can boil it down to the following line:

This works:

var gr = new GlideRecord();

This does not:

var ga = new GlideAggregate();

Does anyone know a related issue/solution, so that i can use the GliedeAggregate. Currently my only other option would be to use a GlideRecord and loop through it to count the entries in the table.

Thanks in advance.

ps.: i got to that state of isolation of that line by using any possible addition within the script. Basically if i have a UI Page build like this:

// do something

var gr = new Glide.........();

// do something else

depending on if i use GlideRecord or GlideAggregate the "something else" stops working. And (with my limited knowledge of j-script) declaring a variable should not inpact the general functionality, except if that very line results in an error. As far as i can judge the current situation it is not possible to use a GlideAggregate in this context. Which is confusing me, since GlideAggregate inherits from GlideRecord.

1 ACCEPTED SOLUTION

cameronrichard
ServiceNow Employee
ServiceNow Employee

Hello Fabian,



There isn't a GlideAggregate client side javascript library.



This would be better accomplished via an REST API or Ajax call to a server side resource. You can use GlideAggregate on the server side.



Thanks,



Cameron


View solution in original post

2 REPLIES 2

damodarreddyp
ServiceNow Employee
ServiceNow Employee

Create a Script include to perform the aggregate operation you are expecting and invoke it from UI page? Hope that should, i am exactly not sure why we cannot use Glide aggregate on UI page.


cameronrichard
ServiceNow Employee
ServiceNow Employee

Hello Fabian,



There isn't a GlideAggregate client side javascript library.



This would be better accomplished via an REST API or Ajax call to a server side resource. You can use GlideAggregate on the server side.



Thanks,



Cameron