I need some help with this.
I have a table called PhoneTable with columns [ID], [Phone], [Email (user email)], [TimeStamp], and [Status].
Phones can be duplicate with status “working” or “delete”, but must be unique with status “approved” or “pending”.
My problem is when a user changes the status from “working” to “pending”.
I am doing it by using [_THISROW_BEFORE] and [_THISROW_AFTER] values. The keyword that triggers the appropriate workflow is “pending”. That workflow changes status to “delete” on the other rows. And this is where the problem occurs.
When two users try to send the same phone for approval ( status changes to “pending”) in very short time from one another (1 or 2 seconds), the [_THISROW_BEFORE] value for the second user is not yet changed and causes duplicate entries to happen.