Save filter values in a list

Save filter values in a list
Hi !!

Please I need help.

I am doing a custom script in a doctype. I applied a filter in a link field and I need get all the elements which were filtered in a list or in a variable.

Please somebody have any idea that I could do this? I tried do this for some days without results.

1 Like

Hi @daniel_chiluisa

cur_frm.fields_dict['customer'].awesomplete.suggestions

should give you the list of last suggestion- basically filtered list.
Also a cache is kept at

cur_frm.fields_dict['customer'].$input.cache

Open a browser console and type these in from the Sales Invoice after having something popup in the Link FIeld.

Hope it helps!

1 Like

Thanks for the help!

I tried two codes but when I try to print the list with the elements with the code
cur_frm.fields_dict[‘customer’].awesomplete.suggestions I get undefined.

The other solution works but when I try to access to elements of the list those ones haven’t a name

Suggestions comes only after you have entered anything in the Link Field.
Try expanding the dicts, name is present within 2 levels depth I think.

Try all these with the browser console, you will find it easily.
EDIT: the value field is the name field

1 Like

Thaks!

It is work now, but only fill the list when I focus in the field which has the filtered values but this field is a hide field.

Thanks for your help.

Let me close this now ?
I hope you got your answer ?

Thanks

I solved that with your suggestions. thanks for your help :smiley: :neutral_face: