Lock Forms at certain time

Good evening!
I need to lock the dataset at 09:00 AM after a day pass the expiry days. I know we can lock the dataset using expiry days. But i need to expire the dataset after a day at certain time.
I Don’t know if i made you clear about my problem.

Any help will be greatly appreciated.


Hello @sybghat
This is not currently possible, but a work around for this would be a script that adds an extra day at the opening of the new period and removes it the specific time and day you want the data set to close.


This is not currently supported as @juan points out. Another way would be to use the data approval feature. Using approvals, you can lock the data at any time to prevent changes to the data values. This could also be scripted via the API to lock the data at a very specific time period.

You can read about data approval here


Thank you every one, i used custom script for this piece of work. On document.ready i check the date selected and today date in my location, compared both dates and then i compared the time. If time is greater than 11 then i disabled all the fields. so data can not be entered. Is there any API for locking and unlocking the dataset ?

Thanks for sharing your solution!

Doesn’t this mean that you will have the browser requesting the location info and current time? But this means that the user shouldn’t be using a VPN and that their location is accurate so I think the browser might miss out somethings, right?

Maybe if you use the data approvals as suggested by Jason?

Yes, if you use the Data Approvals then here’s the resource for the dataApprovals API: Data Approval - DHIS2 Documentation

I think you’d use two requests, one during the lock time (unapprove data) and one during the unlocked time (approve data)…

1 Like

@Gassim I used constant source for this piece of work. I call the API to get the day, time of Location where the project is currently lanuched.

1 Like