I have a List called ASSET_LIST where I am using a filter in the list properties client side filter. I'm filtering based on the value in another list:

data.id_location == {dialog.object}.getValue('list::LOCATION_LIST::id_location')

I create a new record using the {dialog.object}.formViewNewRecord('FORMVIEW_APPRASIAL') method (the list is using a formview as the detail view) which is invoked from the onClick event of a button.

I'm using the following to commit the changes back to the list:

var result = {dialog.object}.formViewValidate('FORMVIEW_APPRASIAL');
var flagOnlyCommitDirtyFields = false; //applies only when committing to a List control

However, when I have the filter in place in ASSET_LIST, I get errors when I try to save the new record, "Message:UncaughtReferenceError: <fieldname> is not defined"
Fieldname seems to be any arbitrary field on the formview, as if I remove that field, it will give the error on another field.

I have tried setting the default value of the id_location field in the new record to the value of the id_location field of the selected record of LOCATION_LIST :

var loc_id = {dialog.object}.getValue('list::LOCATION_LIST::id_location');
return loc_id;

So the new record should have id_location set to the value in LOCATION_LIST which should satisfy the filter in ASSET_LIST. However, I still get the error. Any ideas on how to resolve it ?