Exam is an object. It contains the following fields - exam_name(String), exam_state(picklist), exam_date(date), expiration_date(date)
'exam_name' is an AutoNumber(string) field (starts from 1 and increments depending on the number of exams registered)
Below i have provided a pseudocode kinda.
Loop through the exam_name 1-100000. check exam_state, check expiration_date. if(and( exam_state is "active", and expiration_date > exam_date + 30)). set exam_state to "expired").
In theory, I want my code to find the exam_name field which is the primary_key, loop through all of it(eg. 1-100000), check the 'state' of each exam_name, set all the exams that have exceeded the 30 days from the day they were set-up, to change from "Active" state to "Expired" State. I want this to run daily.
How can i execute this? I'm new to salesforce working with a sandbox, i tried out work flows, process automation etc., but wasn't able to figure this out.