(always forgive my bad English)
I have this problem,I’m making a form (very simple) to book classrooms.
From a combo I select the teachers who request it. The field does a lookup on another table and I only display name and surname.
Another user (secretary) then edits the form and confirms or not the reservation. In these two phases I would like to:
send an email to the office (you have received the booking request)
send an email to the teacher to confirm or refuse the reservation of the classroom.How do I retrieve the teacher’s email address when I select the surname / name from the combobox?
When I open the form with the user secretariat how do I send on the event save the email to the teacher?Enable email notification on ADD and EDIT.
I use the function Email_Sending
I have several pieces of the puzzle that escape me _While I’m writing, I was thinking that instead of the teacher combobox, I could use the information of the current user (the teacher) and retrieve the email address differently (by setting the address of the answering machine by code).
But logged in as a secretary I need to have this information (teacher email address, I guess I should save it even in a field of the db).
Basically, you may create a Database View based on your existing related table(s), and then use that Database View object in order to send emails that suits your needs.
No difficulty in creating a view that crosses the two tables. However, I don’t know how to use your suggestion.
On the table “reservations” I have the requesting field that makes the join with the registry of the “applicants” (teachers).
In this way, it is clear to me, I retrieve the address associated with them.
But the select should start every time the value of the combo changes and the email field returned I have to use it during the save phase to send the email.
I need some examples
I currently have only CurrentUserName() as information (I’ve seen in other posts also CurrentUserInfo() but I don’t know if it can help me), from username of the user I would like to get (reading the Users table) Name and Surname and email address.
Recovered the email I still need to understand how to send the email only to this address.
Even just a few examples and where to place it among Server Events is necessary.Thanks in advance
I once did something similar using PHPMaker 2017. In fact, mine was slightly complex because I included other fields from different tables. Here is what I did; In Server_Events → Email_Sending, I fetched the required information via ew_ExecuteScalar, stored it in a variable and passed it to the relevant email fields.Refer to the snippet below. Server_Events → Email_Sending
function Email_Sending(&$Email, &$Args) {
if (CurrentPageID() == “add”) {
$fullname = ew_ExecuteScalar("SELECT CONCAT(lastname,' ',firstname) FROM employee_master where emp_id = ".$Args["rsnew"]["emp_id"]." ");
$mgr = ew_ExecuteScalar("SELECT CONCAT(lastname,' ',firstname) FROM employee_master where emp_id = ".$Args["rsnew"]["line_mgr_id"]." ");
$Email->Cc = ew_ExecuteScalar("SELECT email FROM app_users WHERE emp_id = '" .$Args["rsnew"]["emp_id"]."' ");
$Email->Recipient = ew_ExecuteScalar("SELECT email FROM app_users WHERE emp_id = '" .$Args["rsnew"]["line_mgr_id"]."' ");
$Email->Subject = "Notice: ".$fullname." Has Applied For ".$Args["rsnew"]["requested_days"]." Day(s) ".$Args["rsnew"]["leave_type"]." ";
$Email->Format = "HTML";
$Email->Content = " ";
$Email->Content .= "Hello ".$mgr.", <br> <br/> A Leave Request Has been submitted</p>";