I want to send a mail on save to the mail in the field “reports_to”
The following server and client script works but I need to mention the exact mail which need to send and trying things like recipient = frm.doc.reports_to says stuff like doc is not defined or frm is not defined
im new to ERPNext/Frappe pls let me know what i should do
frappe.db.get_single_value
frm.doc.reports_to
etc has not worked
Below is the client and server script
frappe.sendmail(
recipients="example@mail.com",
subject=_("Hello!"),
message=_("Hi!"),
delayed=False
)
message = f"""
Hello
"""
frappe.ui.form.on('Form Test', {
after_save: function(frm) {
console.log(frm);
frappe.call({
method: 'send_email_to_reports_to',
args: {doc:frm.doc}, // pass frm.doc instead of doc
callback: function() {
}
});
}
});