Overloading query

Hello everyone,

I have a link field which which displays all suppliers. I would like to write a custom script such that it shows only those suppliers whose type=‘manufacturer’ . How do i go about this ?
I came across this piece of code which is suppose to overload the query.I tried changing this to my requirements but it pops a error “this query style is discontinued”.
Could someone help me understand this? and how do i change this to fit my needs ?

cur_frm.fields_dict['test_link'].get_query = function(doc,dt,dn) {
   return "SELECT tabDocType.name FROM tabDocType WHERE IFNULL(tabDocType.issingle,0)=0 AND tabDocType.name LIKE '%s'"


Hi Akarsh_Hegde,

Please consider following syntax, you can add multiple filters as per requirement. While processing system generates where clause and joins with "and " condition operator in case of more than one filter.

cur_frm.fields_dict[‘link_field_name’].get_query = function(doc) {
filters: {“type”:“manufacturing”}

Also try to avoid querying from js.

New Indictranstech Pvt Ltd


That worked like a charm! Thanks a lot.
Yes, will keep that in mind henceforth.


In case that i need a more complex query like a JOIN or a field = SQL QUERY. There is a doc with or the posibilities or where i can get examples.


You can write your query in .py file of your app and call it from js.

Ref links ,

1 Like