Want to fetch all status (left, active) of employees

Hello, Guys Need Your Help…,

Wants to fetch all left as well as activate employees in Employee doctype.

I have written a custom script as follows…,

frappe.ui.form.on('Payment Entry', {
    party_type:function(frm){
        var abc = cur_frm.doc.party_type
        console.log(abc);
        
        if(abc=="Employee"){
            frappe.call({
                method: "frappe.client.get_list",
                args: {
                    doctype: "Employee",
                    filters: [
                        ["status", "=", "active"],
                    ],
                    fields:["*"],
                },
                callback: function (r) {
                    if (r.message) {
                        console.log("In Response")
                        console.log(r.message)
                    }
                }
            })
        }
    }
})

But it will return only active employees i want all employees like status = active or status = left also…how to do this.

This way you will get all employees.

frappe.ui.form.on('Payment Entry', {
    party_type:function(frm){
        var abc = cur_frm.doc.party_type
        console.log(abc);
        
        if(abc=="Employee"){
            frappe.call({
                method: "frappe.client.get_list",
                args: {
                    doctype: "Employee",
                    filters: [
                        ["Employee","status", "in", ["active","left"]],
                    ],
                    fields:["*"],
                },
                callback: function (r) {
                    if (r.message) {
                        console.log("In Response")
                        console.log(r.message)
                    }
                }
            })
        }
    }
})
1 Like

Thanks, @Maheshwari_Bhavesh for the reply,

but it will show only 20 records insted of 32 employees…!!

you should pass page length

1 Like

Yes, I solve this by searching. I find all records using suggested code. It works Perfectly Thank You.