Link filtering according other field

Hello dear community,

I have problem with link field filtering.

I have 3 doc type.

Doctype 1: Brand names

Doctype 2: Model names

Doctype 3: Device

I want to filter “Model” field according selected brand on the upper field

I need your help!

If that didn’t help just search “Filter Link Fields”, you’ll get tons of results.

Hi @RustemHesenov,

Adding @Yamen_Zakhour answer,

You can also use standard link query by using set_query via the Client Script DocType from the desk.

So please check the documentation of the Overriding Link Query By Custom Script

Thank You!

Thank you @Yamen_Zakhour and @NCP!

frappe.ui.form.on("Devices", "onload", function(frm) {
    frm.set_query("device_model", function() {
        return {
            "filters": {
                "model_brand": frm.doc.devices_brand,
            }
        };
    });
});

With your contribution I implemented this code for filtering. Working correct!

Thank you for your support!