Lookup Filter with Multiple fields


I need to filter a lookup as follows:

Lookup field name is Sales Person

Filter columns
Active - Yes/No field - Yes
BusUnit - LookUpID field- Stored in another variable
MultipleBusUnit - Yes/No field - Yes

So in other words something similar to this

BusUnitID = fd.field('Bus_x002e_Unit').value.LookupId;

Filter string = (Active eq Yes or BusUnit eq BusUnitID) AND (MultipleBusUnit eq Yes)

What is the syntax I should use please?

For the first part I tried these but not even this is filtering

var v = true;
var strFilter = 'Active eq '+v;
fd.field('Sales_x0020_Person').filter = strFilter;

or this

fd.field('Sales_x0020_Person').filter = "Active eq '" + v + "'";

I think the problem is reading the YEs/No field which I assume is boolean.

Can you help me please?

Dear @Daniel_Privitelli,
For Yes/No fields it's always 0 or 1 without extra 'quote marks', filter it like this:
fd.field('Sales_x0020_Person').filter = "Active eq 1 and MultipleBusUnit eq 0 and BusUnit/Id eq 42";

Thanks a lot for your reply :smiley:

1 Like