Jim Coyne
Kilo Patron
Part of the Developer Toolbox Series.

 

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

 

Sometimes you need to remove a couple of specific records from a List View query so you can export or do something else with the remaining 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" and doing a bunch of "Filter Out" operations is a pain.  This tool attempts to solve that.

 

Just check the records you want to remove and select the "Update Query WITHOUT Selected Record(s)" context menu item and the current List View will be reloaded without those records:

 

JimCoyne_0-1688699846186.png

 

JimCoyne_0-1688700285024.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 WITHOUT 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
    }
    var idArray = ids.split(",");

    //update the conditions and refresh the List
    g_list.addFilter("sys_id!=" + idArray.join("^sys_id!="));
    g_list.refresh();
})();

 

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.