Dealing with concurrent record updates

Dealing with concurrent record updates

Hi all,

Maybe this is a problem, the 
concurrent record updates, that you already detected. I want to share with everybody a very pretty way to overcome this kind of problems.

The concurrent update problem happens when you try to update a record which already has been updated. For example, two different application users are changing a candidate (or any other entity) information using the same screen, both click SAVE with a diference of 2 seconds. As you may know, if you don't build any to prevent this situation, both are going to see a success message but only information sent by the second user is going to be present after this process without sending any notification to the first user.

One of the simplest ways to solve this problem is blocking, by raising an exception, the second SAVE. You can build it using the following steps:

1. Add an attribute to the Candidate entity to keep track when the record was updated;

2. Add logic to user screen preparation to store when the record that you are changing was updated;

3. Create an action to detect changes based on the 
CandidateId and the UpdatedOn;

4. Call the previous action whenever you are trying to update a candidate (eg. Save action used by the screen).

Paulo Garrudo