Link only active employees in custom doctype

I’ve created a custom doctype and added few fields. Employee field is added as a link field type where I’m getting all the employees data. But I want to show only employees who are in active status.

In the above screenshot the Employee JSG 1007 is an inactive employee but still showing in the list. How we can use the filter to hide it.

Hi @Rahul_Singh,

Please apply the clinet script for it.

frappe.ui.form.on("ESIC Monthly Contribution Form", {
    refresh:function(frm) {
        frm.set_query("employee", function() {
            return {
                "filters": {
                    'status': "Active"
                }
            };
        });
    }
});

Please check/set the doctype and field name in the script.

Reference: Overriding Link Query
I hope this helps.

Thank You!

2 Likes

Thank you @NCP ,
This solution is working for me.