LiquidPlanner Classic Forum
Approve Timesheet via API when Week=0 hours
My client asked me to lock (Approve) all timesheets via API based on a timeframe (2 weeks or older).
The issue is that I can't find timesheet IDs for any timesheet that has a total of 0 hours logged. Other than using the timesheets endpoint, is there a way to list all timesheet ids for any particular member?
Hi Gabriel,
If the timesheet does not have any time logged in a given week and it has not been locked, when you try to get it via the API, you will get nothing back, an empty set. That is because, on the backend, an open timesheet with no time tracked does not exist. We generate a timesheet object when time gets logged, "just in time". And so, it is not possible to lock a timesheet via the API if no time was tracked since technically that timesheet does not exist.
For an alternative, you could track some time for a person on a dummy task on any day of the timesheet week to create a timesheet for that person/week, delete the time entry immediately (the timesheet will continue to exist & it'll be empty), and then you'll be able to lock this timesheet via the API.
ο»Ώ