How do I add an OR clause in filter created in script

Hello all,

Just started coding with ERPNext. Very nice product. I’ve added a custom script to filter the items in a dropdown on a doctype to include only specific items from a linked doctype. This works fine with a single filter:

frappe.ui.form.on("Truck Setup", "refresh", function(frm) {
    cur_frm.set_query("driver", function() {
        return {
            "filters": {
                "designation": "Truck Driver"
            }
        };
    });
});

As you can see designation will only take items with designation “Truck Driver” from the HR Module. How can I filter based on 2 options such as “Truck Driver” and “Vehicle Driver”

Is there any “OR” clause ?

this should help :slight_smile:

filters: {
    "designation" : ["in", "Truck Driver, Vehicle Driver"]
}

References:

2 Likes

Awesome. Thanks to all!