I'd like to see the ability to query for records from a script. An immediate need and example of this would be determining the exact record(s) specified by a set of filtered picklists. The picklists themselves contain only information about the record(s) in the workspace they're tied to. Since there's no guarantee that enough picklists are provided by the configuration to identify a single record in that workspace, in general you can't use this functionality to pick a single record.
However, if I want *all* the records that meet the filtered picklist criteria, or if I've designed the set of picklists such that picking a value from each one will identify a unique record, I'd like to know what record(s) the user has selected. I can currently do this with some pretty clunky (and limited) workarounds as described in this forum post:
Fundamentally I"m using the brute force approach of checking every record to see if it matches my criteria. To improve performance (and get around the script run time limit) I have to maintain a list of all valid objects on another record in a special workspace. This lets me reduce the number of records I check against. Eventually, though, as the number of records to check against grows, the script run time limit could be hit and the functionality will break.
All that trouble could be replaced with the simple ability to query records of a given workspace based on FieldID values.
In the simplest implementation I could see it working something like this:
var matchingItems = queryItems([WORKSPACE], [NAMEVALUEMAP]);
[WORKSPACE] = the name of the workspace to query
[NAMEVALUEMAP] = a map of FieldIDs and specific values
queryItems() would return an array of matching items, or null for no matches.
This would be great for extending the functionality of filtered picklists, and it has a lot of other general uses as well.