iDynamics Working Hours - Developers
Customization Events
At the moment, the application includes customization events that are related with the generation of employee entries, all of them located in the codeunit IDPWHR Employee Entry Mgt.
OnBeforeGenerateEntry
procedure OnBeforeGenerateEntry(var Employee: Record Employee; var Date: Date; var EmployeeEntry: Record "IDPWHR Employee Entry"; var Handled: Boolean)
begin
end;
This event is executed before attempting to generate entries for an employee and date. The method receives these parameters, an employee's work entry post (without initializing) and a Handled parameter.
This allows us to completely replace the entry generation logic of the application. To do this, you will need to subscribe to the event, change the value of Handled to make it true, and assign the created record (if applicable) to the EmployeeEntry variable.
iDynamics Working Hours uses the Employee Entry variable only to pass it to the OnAfterGenerateEntry event, for compatibility purposes (with other extensions that could be subscribed to such an event).
OnAfterGenerateEntry
procedure OnAfterGenerateEntry(var Employee: Record Employee; var Date: Date; var EmployeeEntry: Record "IDPWHR Employee Entry")
begin
end;
This event is launched after generating an employee work entry, for a specific date and employee. The event receives these two parameters, along with the created entry.
OnBeforeDeleteEmployeeEntry
procedure OnBeforeDeleteEmployeeEntry(var EmployeeEntry: Record "IDPWHR Employee Entry"; var Handled: Boolean)
begin
end;
By default, the application does not allow us to delete employee entries if they are locked. Although the entries can be unlocked at any time, we may at some point want to launch a process that skips this control (e.g. a cleaning process that deletes old records exceeding N years). To do this, the process can subscribe to this event (using a manual subscriber) and set the Handled parameter to true.
Integration with other systems
For customers who have a hardware access control system, or who want to integrate any other presence control solution with iDynamics Working Hours, the application publishes a web service, both by SOPA and by OData (REST), which allows us to automate the work report.
By default, the SOAP service will be available at the following URL:
https://api.businesscentral.dynamics.com/v1.0/WS/{Empresa}/Page/IDPWHR_ActivityLine
And the OData service here:
https://api.businesscentral.dynamics.com/v1.0/ODataV4/Company('{Empresa}')/IDPWHR_ActivityLine
The service allows us to send, either through an XML using SOAP, or through an object JSON using API REST (OData), the following data:
- EmployeeNumber. The employee's ID number in Business Central.
- Date. The date for which the record is being sent.
- LineNumber. This parameter is expected to 0, it will be the server that assigns it when receiving the record.
- StartTime. The start time of the record being sent.
- EndTime. The end time.
- Type. One of the following: "Ordinary Hours", "Extra Hours", "Overtime" or "Absence".
- AbsenceType. When sending an absence, the code of the associated type.
- Comments. Optionally, comments associated with the entry.
All these data correspond to the detail by hours (lines) of a Daily activity log. Although technically, in the system, these lines require a header record with the date and time, this record is automatically created, if it does not exist, upon receipt of a detailed register such as the one specified above.