Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

"Group by" in report causes Security Constraints

NickBaker
Tera Contributor

I have a script include that accepts in a table, field, and custom query and displays duplicate values.   I use this script include within a filter to build certain reports.   The reports display the exact information I'm after, but whenever I try and specify a field to "Group By", I get the Security Constraints message below.

SecurityConstraints.jpg

I've tried enabling debugging to highlight what ACL may be missing, but I wasn't able to find anything obvious.   As stated above, if I don't choose a field to "Group by", the report runs perfectly and displays the records I'm looking for.

12 REPLIES 12

LaurentChicoine
Tera Guru

Hi Nick,

I have the same result with a similar use case (using a script include filter). Did you find any workaround or solution to this bug?

Unfortunately I was never able to find a solution.  Please update if you find a solution of your own.

Hi Nick,

Thanks for the quick answer.

In my case I was able to solve my issue by modifying my script include and the way I call it.

To find cases where a user has more than X asset of a model, I needed to do a GlideAggregate call and use the addHaving function. So to be able to do that GlideAggregate call I needed to pass the query I wanted in the client script include so I was for example passing: install_status!=7^model_category=81feb9c137101000deeabfc8bcbe5dc4

During troubleshooting I found out that if a was passing a query that did not contain "^", it was working correctly with the group by. So my first thought was to encode "^" so to send "%5E" and in my script include I would decode it. This worked well for list but did not work in reports. I did some debugging and it seems like my script include was receiving the decoded version, also when saving the record the "%5E" was being decoded.

So for the moment, my workaround will be to use a custom character to replace "^" for the moment I chose to use "|" but other characters might do the job, the only issue would be with a character that you actually want to use in the query.

Then in my script include, I have the following script line to put back the "^" before doing my query.

encodedQuery = encodedQuery.replace(/\|/g, '^');

Same problem 3 years later...
Did anyone ever find a solution for this when creating a report?

Since we can't use a script include when users want to group something in a report on a dashboard...

What is the filter on your report? Could you comment with the encoded query for that report?