Quantcast
Channel: Mendix Forum Questions
Viewing all articles
Browse latest Browse all 82362

Entity State Contention In Microflows

$
0
0

We originally had a Template grid in place that had multiple buttons in it.  For example, Claim and Release buttons which were wired to specific microflows.  This worked well except that Template Grid was had the following issues.

 

  • Template Grid did not support sorting
  • If you clicked the header of the Template Grid it would execute the default action
  • You could not resize columns
  • Etc.

 

So we converted it to a Data Gid and used an enumeration along with the Data Grid Extension from the App Store to display the buttons in a column.  The trade off is that you can only have one microflow assigned now instead on one per button as in the case of the Template Grid.  So we created a microflow that would determine which sub flow to call.  This works fine as one would expect.  We simply look to see if the entity’s Claimed status is True, and if so we assume the user clicked Release.  Likewise, if the Claimed status of the entity is False, then we assume the user clicked Claim.  In the microflows we update the enumeration which causes the buttons state to respond accordingly in the UI.

 

The problem arises when we introduce multiple users in different browsers.  If user 1 clicks the Claim button, everything works as expected and the entity is assigned to user 1.   However, user 2 still has their screen up and it look like they can claim it to.  So user 2 clicks the Claim button.  This call the single microflow with the logic to determine which sub microflow to call.  The logic looks at the entity to determine if it was claimed and magically it is because user 1 claimed it.  But this is bad because user 2 will be sent down the path of Release, which is not the intention since they clicked the Claim button.  There is no context as to what the entity state was when user 2 clicked the button.  It is as if it always pulls the latest version from memory on the server if there is one available.  

 

What are the best practices for handling these scenarios.

 


Viewing all articles
Browse latest Browse all 82362

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>