Child table value Duplication

Hi @VINOTH,

Please try it.

frappe.ui.form.on('Child Table Name', {
    duplicate_field_name: function(frm, cdt, cdn) {
        var d = locals[cdt][cdn];
        $.each(frm.doc.table_name, function(i, row) {
            if (row.duplicate_field_name === d.duplicate_field_name && row.name != d.name) {
               frappe.msgprint('You added already exists on the table.');
               frappe.model.remove_from_locals(cdt, cdn);
               frm.refresh_field('table_name');
               return false;
            }
        });
    }
});

Thank You!

3 Likes