How to Automatically Set Country Code

on is missing and also } closing bracket is missing. :wink:

but @PRaful_9898, you can use onload instead of refresh and don’t use the frm.set_value

Try the following code. I tested it and it worked for me, but I’m not sure about other scenarios. Please check it.

frappe.ui.form.on("Customer", {
   onload: function(frm) {
      if (frm.doc.country == "India") {
           frm.doc.phone = "+91-";
      }
   }
});
2 Likes