Round Robin User Assignment ?

I need an advice on implementing following task.

After "submitter" submit an item I need system to automatically assign it to a user how has a “Approver” role. There can be multiple users that have “Approver” role. So system need to assign items according to round robin pattern.

Can some one guide me to implement this.
  • I think you need a field for each authorized Approver's most recent date. Each time the process assigns an item to an Approver, a script should update the most recent date field. When selecting an Approver to whom to assign the item, the script should select the Approver with the lowest (oldest) date.
  • I would create a two field auxiliary table, with field 1 "sequence" and field 2 "userid". Store the last sequence assigned in the "0" sequence record. For example:

    0 | 2
    1 | 453
    2 | 32
    3 | 43

    Then handle it like a number wheel table. Lock it, get the next id, and increment the 0 record. In the example above you would lock it, do a ReadWithWhere for Sequence 0 to get the last numbe(2), do a ReadWithWhere for 2 1. You will get user id 43 and then set the 0 record to 3. The next time your ReadWithWhere wouldn't get anything, so you would do a ReadWithWhere for sequence 1, and update the 0 record with 1.

    The advantage of maintaining it in a separate table is you can add/remove users over time with no code changes and you can use the auxiliary table maintenance function to add and remove users.