Just a small note to inform you about a new CRMScript function I thought would be useful:
SearchEngine.executeToJSONBuilder(JSONBuilder jb, String fields, String arrayName)
The function came about because I realized that the old se.executeJson() was too limited. Using the columnnames as fields in the json was not useful, and all column types would become strings. Also, if you needed to include more json, it would not work. This new function allows you to execute a json and populate an array in a JSONBuilder instance with the result. The fields parameter is a comma-separated list of "label:fieldType" elements, when label becomes the json attribute name, and the fieldType can be "Integer", "Float", "Boolean" or "String" (default). Consequently, you have much more control of the resulting json (Boolean for instance will become "true" or "false" without the quotes). Finally, by populating a JSONBuilder, you can include other queries or properties as well, to create a larger structure where this query is just one of multiple attributes (the arrayName becomes the name of the array).
se.executeToJSONBuilder(jb, "id:Integer,heading:String,amount:Float", "sales");
Just submitted, so it will be part of 8.5R05.