Tony Chatfield1
Kilo Patron

If you have ever needed to debug code with multiple encoded queries you will know it can have it's moments, especially as your often dealing with the result of someone else’s headspace. 

Sure you can write the queries to log, but the resulting summation isn’t always easy to visualise or validate,
and sometimes the solution to your issue can be very obvious, based simply on what you see - or don’t see

I have never found an easy way to review and validate encoded queries, have I missed something somewhere?
So after a recent encounter, I knocked up this basic record producer, which will make life easier if (when) there is a next time.

All it does is create a url from entered data and navigates to the url on submit.
This allows you to see the actual encoded query results (from your log data), and the resulting breadcrumb filter.

  • Sometimes you can learn a lot quickly simply by expanding the breadcrumb.

Simple example of a syntax error
find_real_file.png

Result
find_real_file.png

Difference if the first encoded query is terminated properly, with a carat (and)
find_real_file.png

 Result 2 The filter is correct and now includes the hard OR query
find_real_file.png

 

The record producer code is minimal

var url = '/' + producer.tableVariable + '_list.do?sysparm_query=' + producer.query1Variable + producer.query2Variable + producer.query3Variable; //repeat for as many encoded queries as you feel you need to add.
current.setAbortAction(true);
producer.redirect=url;

 

 

An updateset is attached, for anyone who wants to give it a try without breaking a sweat.
The update set includes

  • The record producer script pushes the variables to session data, meaning they are available to the producer if you navigate back to it.
  • A client script populates any existing session data on load.
  • A ‘reset’ client script clears the form (it does not clear the session data)
  • Finally a menu module ‘Encoded Query Test’ is added to System properties so it's easy to find\access (requires admin role).

I have included fields for up to 3 separate encoded queries, just because 3 is the most I’ve ever encountered in 1 glide query; but if you need more then adding them is only a few clicks.

Not cutting edge but hopefully someone else finds it useful.

 

Note: To allow for ACL’s and\or domain separation you would need to copy the resulting url and browse to it whilst impersonating your user.

Version history
Last update:
‎03-02-2021 04:42 PM
Updated by: