Jim Coyne
Kilo Patron
Part of the Developer Toolbox Series.

 

The reverse of the "Update Query WITHOUT Selected Record(s)" Tool.

 

Sometimes you need to get a couple of specific records into a List View query so you can export or do something else with the records.  And it can be a pain to get just the right ones, especially when you can see them right there.  There's no obvious quick way to perform a "Show Matching" or "Filter Out".  This tool attempts to solve that.

 

Just select the records you want and select the "Update Query with Selected Record(s)" context menu item and the current List View will be reloaded with just those records:

 

JimCoyne_0-1688699357384.png

 

 

JimCoyne_1-1688699508571.png

 

If you do not have any records selected, it will use the sys_id of the record you right-clicked over to open the menu.  Any Fixed Queries are maintained.  I do not have any conditions set on the Menu so it will appear for all users.

 

It's a simple Context Menu with the following configuration:

Table: Global
Menu: List row
Type: Action
Name: Update Query with Selected Record(s)
Order: 500,100
Action script:

 

(function() {
    //get the selected record(s)
    var ids = g_list.getChecked();
    if (!ids) {
        ids = g_sysId; //the sys_id of the record that was right-clicked
    }

    //update the conditions and refresh the List
    g_list.setFilterAndRefresh("sys_idIN" + ids);
})();

 

I've attached an XML file for the Context Menu so you can just import it into your instance.  As always, try it out in your company's development instance first, or better yet, your own personal development instance.