Setting default value for Phone field in Frappe Version 14

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


You can do this by custom field.
In this link, you will find how it …

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!

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.