Customer Search By Custom Field

I have added a Custom Field to Customer called ‘Primary Contact No’ and added this field name to the search fields in the Customize Form.

However there was no result while searching a customer using primary contact no.

Any Clue on how to search a Customer using a Custom Field?

thanks
Akshay

@mehta_akshay

Goto Setup > Configuration > Customize Form

Select the Customer, and define the “search fields” separated by “,”

2 Likes

thanks for reply

I have already done that

And? Is it working like that or not?

No it is isn’t working

@mehta_akshay, some link fields, are based in complex queries! For example the customer, is based in party_filters and it override the standard behavior based on the configuration.

@max_morais_dmm, so is there a work around here? can we search a customer with a custom field value?

@mehta_akshay, do you need change the active filters, like this:

2 Likes

@max_morais_dmm How do I change the active filters? Can I do this in hooks.py? :slight_smile:

@ccfiel, I am unaware of how to change the active filters, however we can use the custom queries for link in custom script to search the customer by a field of our choice

@mehta_akshay Example the Customer Doctype which is a standard doctype fo ERPNext how can we change the search field?

@ccfiel do you need re-create the filter in your app and use a custom module route

2 Likes

Thanks!

@mehta_akshay

you can change the field name in

get_customer_list() in customer.py

and according to that, search result will work.

I experienced a similar issue and found a solution. I have included a link below for reference.