Forms LookUp Filtering

Perfect. Works exactly how i wanted.

Now only thind that i need to do is, that when the BM Reference changes and no value is selected that the filter is removed.

How can i achieve that ?

Nevermind. Found the solution:

function filterProducts(BM) {
   var BMID = BM && BM.LookupId || BM || null;
   if (BMID)
   {
      fd.field('BA_x0020__x002d__x0020_Reference').filter = 'BM_x002d_Reference/Id eq ' + BMID;
      fd.field('BA_x0020__x002d__x0020_Reference').refresh();
   }
   else
   {
      fd.field('BA_x0020__x002d__x0020_Reference').filter = "";
      fd.field('BA_x0020__x002d__x0020_Reference').widget.dataSource.read();
      fd.field('BA_x0020__x002d__x0020_Reference').refresh();
   }
}

Just Check if the Var is empty, undefined, null or whatever and then set the Filter to "" and refresh again.

Found the Solution in Clear a Lookup Filter