Quick entry filters

Hello there,

I am using the following code to filter results of a Link field in a doctype.

frappe.ui.form.on('Appointments', {
	refresh: function(frm) {
		cur_frm.fields_dict['users'].get_query = function(doc, cdt, cdn) {
			return {
				filters: {'parent': doc.customer}

This is not working, when calling the form in Quick Entry Mode. How to achieve this?

Thank you.

You mean this is not working in quick entry only? Have you tried this in full page/form?

@sangram It’s working in full page mode.

Its not working only in Quick Entry Mode.

The JS is located in the appointments.js File.

Any error in console. Do you have both fields in quick entry Customer and User?

There are no errors. The code is correct, all fields are available, I just don’t know how to tell Frappe to use the filter on Quick Entry mode as well.

Any ideas?

Probably it will work by using cur_dialog.doc but I need to get cur_dialog AFTER the dialog was created. As far as I can see, it’s not possible.

Unfortunately currently, the quick entry mode does not honour any client side code.

Thank you. If I knew, where cur_dialog is being set, I could create a pull request for a callback as soon as cur_dialog is set.

From there we could do things like cur_dialog.doc.somefield = 'Something'; cur_dialog.refresh();, which works from Chrome console.

EDIT: I know now, where cur_dialog is set, but it seems not so easy to realize a callback for that.

Another Edit: I found a very simple solution for that. I will create a pull request to discuss and hopefully merge.

1 Like

I hope, thats sufficient:


I also don’t have clear idea about it, I think you have to make changes in quick_entry.js.

its working in full page mode. But My need to make filters in quick entry mode.