Auto populate data when lookup field is auto-selected
I have an email address lookup field that is
auto-selected based on loginuserid:
emailToSelect = Employee[Employee_Email = zoho.loginuserid].ID;
Employee_Email_Address.select(emailToSelect);
Now, when I add a new record and on form load (not 'on success') I want my form to auto-populate additional information related to the employee that is auto-selected via the above code. The following code works, but not on 'On Add' --> "On Load'.
if (Employee[ID == input.Employee_Email_Address].count() > 0)
{
emp = Employee [ID == input.Employee_Email_Address];
input.Employee_Name = emp.Employee_Name;
input.Employee_Department = emp.Employee_Department;
input.Employee_Supervisor = emp.Employee_Supervisor;
// etc.,
}
Appreciate any help.