oguruma
December 14, 2023, 9:11pm
1
I’d like to create a custom field for Users that will store their Twilio phone number.
It will be used for a custom Dialog I am building to send SMS messages via Twilio from Lead/Contact forms.
The problem is that apparently ERPNext doesn’t allow “Core” Doctypes to be customized.
What’s the best way to add a custom field for users?
1 Like
julez
September 11, 2024, 2:35pm
3
Thanks, I went with the 2nd option.
This is how I did it.
Add this to ur hooks.py:
fixtures = [
# Adding custom fields to User doctype
{
"doctype": "Custom Field",
"filters": [
["dt", "=", "User"]
]
}
]
I already had a fixtures directory generated, if you don’t have one you can simply create one in the same directory as your hooks.py called “fixtures”. In there I created a file called “custom_fields.json” with the following content:
[
{
"doctype": "Custom Field",
"name": "User-signature",
"dt": "User",
"fieldname": "signature",
"fieldtype": "Signature",
"insert_after": "username",
"label": "Signature"
},
{
"doctype": "Custom Field",
"name": "User-job_title",
"dt": "User",
"fieldname": "job_title",
"fieldtype": "Data",
"insert_after": "mobile_no",
"label": "Job Title"
}
]
(Use “insert_after” to insert your custom field after a core doctype field.)
2 Likes
Can you mention the version of frappe you are using ?
2 Likes
julez
October 30, 2024, 4:12pm
5
Version 15 for sure, I am not sure about the exact versions but these are the one I use right now:
ERPNext: v15.40.0
Frappe Framework: v15.46.0