Enabling Child Table Fields in Quick Entry for Contact Doctype

In ERPNext, there is a doctype called Contact that includes two child tables: Contact Email and Contact Phone. I want to enable these child table fields to be accessible in the Quick Entry form of the Parent doctype (Contact).

I have already done the following:

  1. In the Customize Form, I enabled the Quick Entry checkbox for both the child tables.
  2. I also checked the Allow in Quick Entry option for the relevant fields.

Despite these settings, only the parent doctype fields are appearing in the Quick Entry form, and the child table fields are not visible.

Can you help me resolve this issue?

Does anyone know how to achieve this?

It looks like ERPNext doesn’t support child tables in Quick Entry by default may be, even if you enable the Quick Entry checkbox in the Customize Form.

A potential workaround is to customize the Contact form using a custom script to include fields from the child tables directly in the Quick Entry dialog. Another option is to disable Quick Entry for Contact and guide users to use the full form to add emails and phone numbers.

Hope that helps!

Thank you for the info! I think using the full form is not better idea. When users try to add contact details and are taken to a separate page, it can feel confusing, as if they’ve left the customer details they were just working on.

Also, the Contact doctype is just one example; there are many other doctypes where child table fields should appear in Quick Entry. Having all relevant fields visible in one place would create a smoother experience for users.

I get your concerns navigating away can be confusing. Including child table fields in the Quick Entry form would definitely improve user experience.

I have submitted feature requests for this issue in both the ERPNext and Frappe repositories. Let’s see what kind of response we receive. I hope they understand the issue.

Quick Entry form is designed for fast data entry and doesn’t provide the same level of customization as the full edit form.
But you can easily achieve this from the listview client script code: please check it.

1 Like

Could you please share the code for the list view client script?

Hi @falah123,

First, you need to learn the basic concepts and apply the client script. Just copying and pasting the code won’t solve the problem; you must understand how it works. There’s no benefit in copying and pasting without truly understanding it. You can’t rely on default settings every time.

This is a sample code

frappe.listview_settings['Contact'] = {
    refresh: function(listview) {
        listview.page.set_primary_action(__('+ Add Contact'), function() {
            add_contact();
        });
    }
};

function add_contact() {
    frappe.db.get_doc('DocType', 'Contact').then(doc => {
        let fields = [
            {
                label: __('First Name'),
                fieldname: 'first_name',
                fieldtype: 'Data',
                reqd: 1
            },
            {
                fieldname: 'email_ids',
                fieldtype: 'Table',
                fields: [
                    {
                        label: __('Email ID'),
                        fieldname: 'email_id',
                        fieldtype: 'Data',
                        reqd: 1,
                        in_list_view: 1,
                        columns: 3
                    },
                    {
                        label: __('Is Primary'),
                        fieldname: 'is_primary',
                        fieldtype: 'Check',
                        in_list_view: 1,
                        columns: 2
                    }
                ],
                data: []
            },
            {
                fieldname: 'phone_nos',
                fieldtype: 'Table',
                fields: [
                    {
                        label: __('Number'),
                        fieldname: 'phone',
                        fieldtype: 'Data',
                        reqd: 1,
                        in_list_view: 1,
                        columns: 3
                    },
                    {
                        label: __('Is Primary Phone'),
                        fieldname: 'is_primary_phone',
                        fieldtype: 'Check',
                        in_list_view: 1,
                        columns: 2
                    },
                    {
                        label: __('Is Primary Mobile'),
                        fieldname: 'is_primary_mobile_no',
                        fieldtype: 'Check',
                        in_list_view: 1,
                        columns: 2
                    }
                ],
                data: []
            }
        ];

        var dialog = new frappe.ui.Dialog({
            title: __('Contact Entry'),
            fields: fields,
            primary_action: function() {
                var values = dialog.get_values();
                if (values) {
                    frappe.call({
                        method: 'frappe.client.insert',
                        args: {
                            doc: {
                                doctype: 'Contact',
                                first_name: values.first_name,
                                email_ids: values.email_ids,
                                phone_nos: values.phone_nos,
                            }
                        },
                        callback: function(r) {
                            if (!r.exc) {
                                frappe.msgprint(__('Contact Saved!'));
                                dialog.hide();
                            } else {
                                frappe.msgprint(__('Failed to save contact.'));
                            }
                        }
                    });
                }
            },
            primary_action_label: __('Save')
        });

        dialog.show();
    });
}
2 Likes

Thank you for your guidance! I completely understand the importance of not just copying and pasting code without grasping the underlying concepts.

I’ll make sure to take the time to learn and apply the client script properly. Your advice is invaluable, and I’ll definitely keep it in mind as I work through this.

Thanks again for your support!