Pass custom args frm.set_query with Custom Query

Hello ERPNext Community,

I’m facing a challenge with frm.set_query in ERPNext and need guidance. My goal is to send custom arguments to a server-side query without having these filters re-applied by the client-side framework.

The Issue: When I pass custom filters to a server-side method, the client-side seems to reapply these filters locally after the server query, altering the returned dataset.

Current Code:

frm.set_query("employee_field", function() {
    return {
        query: "my_app.my_module.my_custom_query",
        filters: {
            'employee': frm.doc.employee, 
            'department': frm.doc.department,
            'branch': frm.doc.branch
        }
    };
});

I have implemented some custom logics on server side, The server-side processes these filters correctly, but I want to stop the client-side from applying them again and I don’t want to apply them.

Question: How can I ensure that custom arguments passed to a server-side method in frm.set_query are not used for local filtering on the client side in ERPNext? Is there any other way to pass my values to server except filters I have tried args but didn’t work?

Any suggestions or best practices to resolve this would be greatly appreciated.

Thank you!

This is my solution for this problem

frappe.ui.form.on(‘Zahlung’, {
refresh: function(frm) {
var xxx = frappe.call({
method :‘myapp.myapp.doctype.zahlung.zahlung.get_object_name’,
args:{txt:frm.doc.localaccountnumber},
callback: function(response){
var query= ‘[’;
response.message.forEach((item) => {
query = query +“'” + item +“',” ;
});
query = query.slice(0,-1);
query = query + ‘]’;
frm.set_query(‘objekt’,function(){
return {
filters:[
[‘Objekt’,‘Name’,‘in’,eval(query)]
]
}
});
}
});
}
})

I would expect, that I just can insert response.message. in my filter.
If someone has a solution for replacing eval(query), would be fine