Change customer search filter based on other field

Hi All,

I want change the filtering of the customer based on ‘IC’ field instead of customer name.
How i write the code in custom script?
By the way, is there any full documentation on custom script?
Appreciate the helps.

Hi @kenny ! See documentation here.

hi @creamdory

I can’t find the customization of search filter in the documentation. Can you show one of the example? thanks.

Hi @kenny ! Have you tried using Search Fields setting of the doctype?

1 Like

hi @creamdory,

it seem only can filter by customer name even if i input other field in search fields. I.E ic .

And i think search fields is only work for ‘customer name’ cause when i try to search by customer_group which is predefined in search fields, it is not working.

Hi @kenny . Try this one link

Regards

hi @creamdory

i think the one you share to me is customize the result of selection by adding filter like ‘group’ = ‘sales’ .

But what i want is actually want to change the default filter of customer selection( by customer name ) to other customization of customer ( IC ).

I think your first answer is relevent but i try to follow your step and it didn’t work.
Below is my screenshot. Hope you can help .:joy:

no result came out.

Hi @kenny! There is a similar usecase here but seems not resolved yet. I actually stumble upon the same usecase myself and my workaround (though kind’a weird), I included the custom field (in your case IC) in my “name” which is b default a search field.

@creamdory

you can change the value of

field

variable in

get_customer_list() in customer.py

which will affect to the searching field in link.

Vijay the solution is okay but the problem is that commit will be a thorn when you run bench update. So you’ll have to manually solve the conflict each time you update.

bench update issue might not overwrite your code.