Attendance record script
I have a script which is working quite well for updating attendance records. It starts in the class session layout. It goes to the attendance layout and makes a new record. In this record I set the attendance field to present, absent etc.
I also use conditional formatting which changes the stuents name to green if present, orange if late and red if absent.
However if a student is marked absent and then arrives late I can change his attendance status to late.
The attendance officer can see all of the movements and changes for each student. I think it would make the attendance officer's job easier if in the above scenario that I could alter the attendance record and change the attendance record from absent to late rather than create a new attendance record. This would give the teacher chances to change his mind several times without creating a headache for the attendance officer.
In my class session portal i have a field which is set to the attendance id of the last created attendance record.
I wanted to make my script conditional so that it creates an attendance record only once for each class session. If a class record has been created for that class session I want to edit that record.
The attendance record has the student id and the class session id that can identify it for that class session. So if a record doesn't exist for a class session then I want the script to make a new record for that class session.
Whats the best way to determine if that record exists in my script so that I can make the script move to its "else" option?