Setting default value for Phone field in Frappe Version 14

How can I set the default value for the Phone filed in a Doctype?

4 Likes

You can do this by custom field.
In this link, you will find how it …
https://docs.erpnext.com/docs/v13/user/manual/en/customize-erpnext/custom-field#11-additional-details

I hope this help…

1 Like

Yes, I want to know also how it is possible to set default country in phone field (introduced in v14)

Found a solution, simply add the country code with a dash afterward, like this:


1 Like

You need to add a space after the dash or it doesn’t work. Note the space after the dash!
image

Putting it out there so that fellow earthians do not go through an hour trying to figure out why the solution isn’t working.

The challenge now is, what happens when a user doesn’t provide a phone number. When they try to save they’ll get this error.

1 Like

same challenge ??

Yes, I wonder if it’s been resolved in Frappe V15.

Use client script to check if user has entered anything by comparing the value with the default. If nothing was entered, set the value for the field to undefined or an empty string, whichever works.

Can you send image again please?