Custom Field
Every form in ERPNext includes a standard set of fields. If you need to capture additional information that is not available by default, you can create a Custom Field without modifying the standard ERPNext code. Custom Fields allow you to extend any DocType based on your business requirements.
You can create Custom Fields from:
Home > Customization > Form Customization > Custom Field
Alternatively, open the List View of any DocType, click the Menu button, and select Customize.
1. How to Create a Custom Field
- Go to the Custom Field list and click New.
- Document: Select the DocType where the new field should be added.
- Label: Enter the display name of the field.
- Field Type: Select the appropriate field type such as Data, Link, Select, Date, Check, etc.
- Click Update to save the field.
You can also add, edit, or remove fields directly from the Customize Form page.
2. Additional Field Settings
2.1 Options
The Options field is used whenever a field type requires additional configuration. For example, a Select field requires the list of available values to be entered here, with each option on a separate line.
2.2 Fetch From
The Fetch From property automatically retrieves values from another linked document. For example, if an Item is linked to a Project, you can automatically fetch the Project’s details into your custom field.
2.3 Fetch If Empty
Enable Fetch If Empty to prevent existing values from being overwritten. The system will only fetch data if the field is currently blank.
2.4 Default Value
Specify a value that should automatically populate whenever a new document is created.
2.5 Depends On
Use the Depends On property to show or hide a field based on another field’s value. This helps simplify forms by displaying only relevant information.
Example:
is_fixed_asset
In this example, the field will only appear when the Is Fixed Asset checkbox is enabled.
2.6 Field Description
You can provide a helpful description that appears below the field to guide users while entering information.
2.7 Permission Level
Permission Levels determine which users or roles can view or edit the field. This allows sensitive information to be restricted to authorized users only.
2.8 In Preview
When Show Preview Popup is enabled for a DocType, fields marked as In Preview appear in the popup displayed when hovering over document links.
2.9 Width
The Width setting controls how much space the field occupies when displayed inside child tables or grid views.
3. Field Properties
| Property | Description |
|---|---|
| Mandatory | Makes the field compulsory before saving or submitting the document. |
| Unique | Ensures that every value entered is unique across all records. |
| Read Only | Displays the value but prevents users from editing it manually. |
| Hidden | Hides the field from the form while keeping its data stored in the database. |
| Print Hide | Prevents the field from appearing in print formats. |
| No Copy | Excludes the field when documents are duplicated using the Copy feature. |
| Allow on Submit | Allows the field to remain editable even after the document has been submitted. |
| In List View | Displays the field as a column in the DocType list view. |
| In Standard Filter | Makes the field available as a default filter in list views. |
| In Global Search | Includes the field in ERPNext’s Global Search results. |
| Bold | Displays the field value using bold text for better visibility. |
| Report Hide | Prevents the field from appearing in generated reports. |
| Ignore XSS Filter | Allows HTML content to be displayed without applying the default XSS filter. |
| Translatable | Makes the field label available for custom translations. |
4. Field Name
- Every custom field automatically receives the prefix
custom_in its field name to avoid conflicts with standard ERPNext fields. - If your implementation requires a specific field name, open the Custom Field document and click Rename Fieldname.