diff --git a/frappe/email/doctype/email_account/email_account.js b/frappe/email/doctype/email_account/email_account.js
index d8e0f57506..a36976d3a8 100644
--- a/frappe/email/doctype/email_account/email_account.js
+++ b/frappe/email/doctype/email_account/email_account.js
@@ -115,7 +115,25 @@ function set_default_max_attachment_size(frm) {
});
}
}
-
+function add_helpful_links(frm) {
+ // For better UX
+ switch (frm.doc.service) {
+ case "GMail":
+ frm.set_df_property(
+ "password",
+ "description",
+ 'To generate password visit here'
+ );
+ break;
+ case "Frappe Mail":
+ frm.set_df_property(
+ "api_secret",
+ "description",
+ 'To know more visit here'
+ );
+ break;
+ }
+}
frappe.ui.form.on("Email Account", {
service: function (frm) {
$.each(frappe.email_defaults[frm.doc.service], function (key, value) {
@@ -126,22 +144,7 @@ frappe.ui.form.on("Email Account", {
frm.set_value(key, value);
});
}
- // For better UX
- if (frm.doc.service == "GMail") {
- console.log("hello");
- frm.set_df_property(
- "password",
- "description",
- 'To generate password visit here'
- );
- }
- if (frm.doc.service == "Frappe Mail") {
- frm.set_df_property(
- "api_secret",
- "description",
- 'To know more visit here'
- );
- }
+ add_helpful_links(frm);
},
use_imap: function (frm) {