ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Adding docField to a doctype



I wanted to add a doc_field to a docType via code. But i was unable to find the way.
Please guide me if you got any!


You need to acess the DocType using frappe.get_doc("Doctype", "MyAwesomeDoctype")
Now you can access the child table that holds the fields and add the docfields you wish.

Please note, adding or deleting docfields on the fly is not a good practice. Create all the fields you want and then hide or show them using controllers on client side