Set_query filter: Doctype has field?

Hi all,

I am looking for a way to filter the selection possibilities in a link field (links to “DocType”) to only those Doctypes that have a certain field with name “field A”. The selected doctype will then be used in a dynamic link field.

Is there a way to set such a filter in the set_query in a client script? Or is a custom function needed?


frm.set_query("reference_doctype", function() {
                return {
                    "filters": [['DocField','fieldname','=','fielda']]
1 Like

Thank you!

Works when setting “reference_doctype” to the fieldname of the link field.

you got it!:grinning: