Scheduler Event Server Script to get all documents and change them

Hello there
I have a custom doctype with a date field and a status field, and I need to make a server script that runs daily and changes the status of all documents of that doctype based on their date field.

I know I have to make a server script with a type of “Scheduler Event” and a “Daily” frequency, but I have no idea how to get the documents and access their fields.

Can anyone help me with a simple example please?

https://docs.erpnext.com/docs/v13/user/manual/en/customize-erpnext/server-script

https://docs.erpnext.com/docs/v13/user/manual/en/customize-erpnext/client-scripts

1 Like

I’ve already searched the docs and I know how to make a server script.
What I need to know is what to write in it (the methods that I can use to get every document (of a certain doctype) and access/modify its fields.

Hi @YamanQD

1 Like