By applying the template to an employee already inserted, the procedure overwrites data such as the city, postal code, province, region and gender.
The function in question is the ApplyTemplate of codeunit 1387 "Employee Templ. Mgt." which does not even allow intervention as there is no event at the beginning of it.
local procedure ApplyTemplate(var Employee: Record Employee; EmployeeTempl: Record "Employee Templ.")
begin
Employee.City := EmployeeTempl.City;
Employee."Post Code" := EmployeeTempl."Post Code";
Employee.County := EmployeeTempl.County;
Employee.Gender := EmployeeTempl.Gender;
Employee."Country/Region Code" := EmployeeTempl."Country/Region Code";
Employee."Statistics Group Code" := EmployeeTempl."Statistics Group Code";
Employee."Employee Posting Group" := EmployeeTempl."Employee Posting Group";
Employee."Application Method" := EmployeeTempl."Application Method";
Employee."Cost Center Code" := EmployeeTempl."Cost Center Code";
Employee."Cost Object Code" := EmployeeTempl."Cost Object Code";
OnApplyTemplateOnBeforeEmployeeModify(Employee, EmployeeTempl);
Employee.Modify(true);
end;
In my opinion it makes no sense that data such as those indicated are part of a model, and at the very least there should be the possibility of choosing whether or not to overwrite the data, or give the partner the possibility of extending this function.
The alternative is to build a "parallel" function, but I would like to avoid this, also because it doesn't seem logical to me.
Business Central Team (administrator)
Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future. Best regards, Business Central Team