Hi!
In our site we have Web-forms that are connected to Leads. My goal is to set conditions that will not allow to save (and send) form, in which e-mail was already used. No two Leads with the same e-mail.
The example code (I use it in Web-form / Customization / field “Scripting / Style”), that should show a message with the value of the Mail field after the page loads, after 2 seconds:
frappe.web_form.after_load = () => {
EmField = frappe.db.get_value('Lead', 'CRM-LEAD-2024-00132', 'email_id');
setTimeout(() => {
frappe.msgprint(EmField);
}, 2000);
};
Printed mistake:
Uncaught TypeError: Cannot read properties of undefined (reading ‘get_value’)
Function get_value don’t work, I was trying in two systems 15 version, in usual and in developer mode.
All other functions, that don’t get information from database are working perfect.
I’m logged in, so there is no problem with access permission.
If you have any advices or see my mistake, please share it!