Problems with addFoundSetFilterParam and loadRecords

I don’t know if I’m not using it right or what, but here is the situation. I want the users to only see active records. So I created a column name status. When a new record is created, it get’s marked as such: status=‘ACTIVE’. This way I can go thru and mark records as status=‘ARCHIVE’ for records that are old and the users won’t see them, but they are still in the system incase I need to pull them back up.
Here is the script I wrote:

controller.addFoundSetFilterParam('status', '=', 'ACTIVE');
controller.loadRecords(foundset);

I have it set to trigger at onShow in the properties pane.

It seems like whenever I run it with “foundset” tag in the loadRecords line, it will load all of the records thereby loosing the users place or found set. It will reload all records.
So I put the “foundset” tag in there so that if a user went out of the form and came back in again, there foundset would still be there.

The problem is that with the “foundset” tag in the loadRecords line it looks like the script does not execute. It goes, and I don’t get any errors, but it does not remove the records marked “ARCHIVE”.

Does anyone have any suggestions? Has this happened to anyone else?

The foundset is the set of records that is currently on your form. Executing “controller.loadRecords(foundset);” means that precisely the set the records that is on your form already, will be loaded, so your foundset stays exactly the same.

To make the filter effective you should use “controller.loadAllRecords();”. See also the sample of addFoundSetFilterParam:

//Add a filter parameter to limit the foundset permanently
var success = controller.addFoundSetFilterParam('customerid', '=', 'BLONP');//possible to add multiple
controller.loadAllRecords();//to make param(s) effective