Making Auto Attendance work

Hi,

I know there has been quite a few discussions on the Forum, but I really haven’t been able to figure out how to make auto attendance work.

I promise you, I have tried to read up all the documentation related to this issue and have tried to tweak around the settings a bit, and I still haven’t been able to make it work.

The deployment here does not use a Biometric Device, Instead uses record their Check In and Check Out by directly accessing the Employee Checkin Document.

As users mark their Checkin In and Checkin Out, is there anyway I can get ERPNext to mark auto attendance for users?

What’s the significance of the Last Synch of Checkin field in the Shift Type? The way I understand it, that’s for the Synch Job to make the Checkins from a Biometric Device? I tried changing this to a future date and it marked a user absent even before the shift was complete.

Will it work if once every few days the Date of Last Synch is changed to the previous day. The way this feature is designed, will it then push the attendance for the days between One Day after the value in the Process Attendance After field and upto the DateTime Value in the Last Synch of Checkin field.

If I do manage to make it work, I will put out a crisp document about how I managed to make it work, so you wouldn’t have to keep answering questions around this. So, please help.

Is there anyway to make this work (Employee Checkin to attendance) automatically without having to press any Mark Auto Attendance Button? Or having to change the value in Last Synch of Checkin field?

Thanks

Jay

The first step would be configuring Shift type. Setup the details and enable auto attendance. There is another section which shows on clicking auto attendance check.
Configure those rules. Employee check-ins/outs are only considered during the shift times entered here.

The Last Sync of Checkin field basically means that the Employee checkin data before the datetime set here would be taken into account for marking attendance. This is a validation so that the system does not mark anyone absent for a future data. I still feel it is not aptly named.
I would suggest adding a backend job which sets it’s value to end of day everyday instead of having to manually change it.

Process Attendance After field needs to be set only once. This is basically the date after which we want the system to start marking auto attendance.

The next step would be assigning Shift to employees. (Shift Assignment doctype)

Above all was part of setting up. Now starts the process.

You can start creating checkin and checkout records in Employee Checkin doctype.
There is a backend job running at the end of the day to mark auto attendance. It will check the shift type which has auto attendance enabled, calculate start and end times based on the rules.
Then it will get the employee checkins for that shift, mark their attendance and working hours.

The Employee checkin doctype can be used with Biometric device, mobile app with API or manually created.

1 Like

Hi Kartik,

Thanks for your post. This makes it easier to see where I have been going wrong.

Yep. That enhancement will just make it easy for users. However, I can see the logic as to why Last Synch of Checkin is important. If an organization uses Biometric Devices the data from the Biometric device is synched periodically, so you don’t want to mark attendance for people, even if it is only marking attendance in the past, when the synch job has not been run yet.

I think a Toggle that goes: Check Ins are generated by: 1. A Synch Job, 2. Users mark their Checkins on ERPNext (or words to that effect), would make it easy to build this enhancement in.

If 1. A Synch Job, the current approach is perfect.
If 2. then a job that runs at the end of the day would be perfect.

Maybe we have to factor a slightly different approach for organizations that run on 3 shifts, but that’s perhaps a slightly bigger enhancement (if a Shift begins at 10PM and goes on till 6AM, is that attendance marked for the day of the shift start? or for the day of shift end?

I mean that’s the amazing thing of building a system for a large audience. What seems like fairly simple and straight forward, actually has nuances that makes it interesting, to say the least.

Thanks

Jay

So I checked this.
It actually runs every hour and compares the shift actual end time (Shift end time + Allow check-out after shift end time) with the Last sync of Checkin time.
If it’s less than last sync of checkin time, it will process the attendance for that shift.

Code reference. This function is called to process auto attendance.

Hi @kartik

I read your reply and followed same steps. But auto attendance is not working anyhow. Below are snapshots of settings I’ve done:

  1. Shift Settings:

  2. Shift Assigned to employees:

  3. Employee Checkin records imported using CSV:

But auto attendance doesn’t get marked for any of these employees. What am I missing here?

Last sync of checkin value is incorrect. Please see above for the explanation again.
Out of all the employee checkins, only last 2 are will be considered by the system. As the IN and OUT are reversed with the time.

@Kartik, thanks for your response. Since these people were working in night shifts so In time of prev date was paired with Out time of next morning. Will that be not considered because it doesn’t fall in shift start and end time?

For

I followed this:

Since I was trying for their July attendance, we wanted system to consider checkin data before 31st July. Any mistake in understanding?

  1. Correct. For night shift, you will need to create another shift type with different in and out time.
  2. In that case, you should change process attendance after to 01-07-2021(1 July 2021).

This change worked. Appreciate your timely responses.

One last point - our people work on rotational shifts that keep rotating every week. Do we need to reassign shifts every week?

Yes. You can use Shift Assignment doctype or Shift Request doctype to assign for multiple days at once.

Kartik if my shift end time is 17:00:00 and date is 6th June 2022 what should be sync date and time. waiting restlessly plz answer

Hi,

You can set the Last Sync in Date on 6th June 2022 and Time after your Shift time to mark the auto attendance.

1 Like

It should be 6 June 2022 17:00.
If you are allowing a buffer time of let’s say 10 mins to let people checkout, then you should keep the time as 17:10 because any checkin after 17:10 will not be considered for marking attendance.

still Auto attendance not being marked.

Please also check all the Pre-requisites for Auto Attendance to work:L

  1. Define the Default shift on employee or define the shift assignment for the employee.
  2. Tick the auto attendance on Shift Type and configure the parameters.

Also check out on the Employee Checkin details that Shift is assigned automatically at the time of registering employee checkin.

I have done every thing according to the instructions but still failed to get auto attendance marked

I may be misunderstanding. For example, if Last Sync is 1 January 2023 17:00, then only the attendance prior to that time/date will be processed, correct?

Is this something that needs to be changed daily?

I have yet to be able to get auto-attendance to work. I have all the prerequisite settings correct with shift assignments, etc.

1 Like

Yes, that is correct.

You can setup in biometric sync utility to update this field daily automatic. Alternatively you can create server script to update the field daily.

1 Like

I am new to ERPNext, so I am not sure how to write a script to do this. We do not have biometrics so employee’s check in/out manually every day.

You may look at a potential solution i have marked here : After Upgrading V14, I am getting Pop Up Time this week must be in format: HH:mm:ss on Shift Shift Type