Child table set default values

Hello everyone,

I have 2 doctypes called Contact and Telephone. In Telephone i have a link to Contact because one contact can have many telephones. I create a Telephones table field in Contact doctype. The table field only appear when the contact is saved and then you can add telephones.

How i can set like default value the name of the current contact to the telephone_contact field in the Telephone table field that i have?

I have to select the contact in the link field but it’s no what i want. i want that immediately you save the contact, all new telephone in the table have assigned the contact name by default.


Why you want the contact name in Telephones table, that is duplicate data. You are already in Contact record, and contact name is parent value of each telephones row.

Thank you very much @nabinhait , now i see that i have a parent column in the table tabTelephones where frappe put the contact name!!!

if you can, please leave me here the right syntax to do reference to the fields of an table field. I want to validate that the phone have this format 000-000-0000.

Add a hook to validate method of Contact

and throw and exception if your telephone is not formatted correctly.

Thanks for your help.