← ClaudeAtlas

add-custom-fieldlisted

Step-by-step workflow to add a custom field to another app's DocType (e.g. Customer, Sales Invoice) from your own app, idempotently via install.py. Use when the user asks to add a field to a standard/ERPNext doctype, extend Customer with X, or store extra data on an existing DocType.
prilk-consulting/frappe-agent-kit · ★ 0 · AI & Automation · score 72
Install: claude install-skill prilk-consulting/frappe-agent-kit
# Add a Custom Field to Another App's DocType For adding fields to a DocType **your own app owns**, just edit its JSON (see frappe-dev) — this workflow is for extending DocTypes owned by frappe/erpnext/another app, where editing their JSON is forbidden. ## Usage Use this skill when: - "Add a field to Customer / Sales Invoice / Item / …" - Your app needs to store its own data on a standard DocType - Reviewing whether a custom field was added the upgrade-safe way ## Steps ### 1. Check it doesn't already exist — and whether a field is even needed ```bash bench --site <site> execute frappe.client.get_list --kwargs "{'doctype':'Custom Field','filters':{'dt':'Customer'},'fields':['fieldname','label','insert_after','module']}" ``` - Field already there (maybe under another app)? STOP — never manage another app's custom fields. - Linking records M:N (contact↔customer, address↔supplier)? Use `Contact.links` / Dynamic Link instead of a new field. - Several related fields? Consider a separate DocType linked back, not five custom fields. ### 2. Define it in your app's `install.py` Add to the existing `get_custom_fields()` dict (create the install.py wiring if the app lacks it — frappe-dev skill has the full pattern): ```python def get_custom_fields(): return { "Customer": [ { "fieldname": "<app_prefix>_<name>", # prefix avoids collisions: "myapp_risk_score" "label": "<Label>", "fieldtype": "<Type>",