How to Create Custom Fields in Doctype via Custom App in ERPNext?
Adding Custom Fields via Custom Apps
In ERPNext, you can enhance your data management by adding custom fields to forms. This blog will walk you through the process of creating a custom app, adding a custom field to the Customer form, and installing it on your ERPNext site.
Step 1: Create the app via below command
bench new-app YOUR_APP_NAME
Step 2: To install the custom app use below command
bench –site YOUR_SITE_NAME install-app YOUR_APP_NAME
Step 3: Create the “fixtures” folder into the YOUR_APP_NAME/YOUR_APP_NAME folder
Step 4: Create a “custom_fields.json” file into the “fixtures” folder
Step 5: Add the below command to add the field “Age” below the “Customer Group” field of customer form.
[
{
"doctype": "Custom Field",
"dt": "Customer",
"module": "YOUR_APP_TITLE",
"name": "Customer-age",
"fieldname": "age",
"fieldtype": "Int",
"label": "Age",
"insert_after": "customer_group"
}
]
Step 6: Add the fixtures in the hooks.py as below
fixtures = [
"Custom Field"
]
So after performing the above steps you will get one custom field “Age” below the “Customer Group” field with “Integer” type.
If you want to add multiple fields then you have to add the multiple dictionaries in the “custom_fields.json”.
You can add multiple dictionaries with different doctypes(“dt”).
NOTE: In the dictionary “doctype” should be always set as “Custom Field” because we are adding the custom field.
By following this step by step guide, you will be able to successfully create a custom app, add a custom field (in our case, Age) to the customer form and integrate it to your ERPNext site.
This method provides you with the flexibility of adding additional custom fields by extending the “custom-fields.json” file with more dictionaries, each defining specific field properties. Custom fields provide you with the ability to make your ERPNext database meet your requirements and your unique business needs. This will further enhance your Data Management and will make your operations more efficient.
Subscribe our Newsletter for Erpnext tips, technical insights, and more!
If you are seeking ERPNext services, Kanak Infosystems LLP. could be the stop for you! We provide ERPNext Implementation, Customization and Integration services. You can reach out to our experts now to seek a free consultation.
Check out our Video to see in the Action - Add Custom Fields in Existing Doc Via Custom App in ERPNext
Get in touch with us!
Your email address will not be published.