Attendance - Workflow - calculate duration value in minutes before last record and second last record

Hi, i am lost… tried but failed
Please do you have any idea if is possible by workflow create this idea? (i wantd add file, but isn’t working for me add file button in edit view of kunema ticket)


Users creating records when started and when finish their work. Look on attachment.

If user create new record in attendance, i want that the last one which is assigned to user will changed status from in process to finished and calculated the time (integrer duration field) between date of create of new record and old one.

In computer lang: choose the second last record of same assigned user as which was created, change value of second last record from in process to finished, modify field duration and put there integer value (minutes) that you computed before second last and last record create date field.

Do you think, that is possible to done in workflows of SuiteCRM?

or only one was how do this is modify the after/before (not suere now) save hook in SuiteCRM?


I don’t see any way to reference the “second last” related record, that is beyond the possibilities of Workflows. Definitely you would need a logic hook.

Another approach would be to restrict the attendence records, only allowing the creation of one per day, per user. So instead of creating a new record, people would be forced to edit the existing one.

I think keeping “initial time” and “final time” (and therefore, “duration”) in a single record would probably make it easier to keep things coherent.