Non-persistent entities not available in Home microflow

2
In our application I wat to count the number of times a user enters the Home microflow in a session, so I can take action when the Home microflow is entered too many times in the same session. I have made an non-persistent entity with a relation to the session. When I retrieve the entity from the session (by association) in the Home microflow, the object is empty. When I retrieve it from a button at a page, it is retrieved well. Is it normal behaviour that the session objects are not available in the Home MF? Or am I missing something…?
asked
3 answers
0

Maybe this is related to the 7.23.4 version, but in the 7.23.5 version I created this in a test project:

  1. Created a NPE entity HomePageCounter with an integer attibute set to 0 by default
  2. Added an association to the session entity 
  3. Created a microflow like below
  4. On the navigation the default home page and home page menu item both call this MF

This will retrieve or create the counter object when opening the home page via the home menu, navigating to the app or when using a show homepage action.

In the test project I did not use security and this might be the issue in your case with security turned on. Check the permissions for the HomePageCounter entity, maybe the user does not have permissions to access this entity?

Hope this helps in finding a solution.

answered
0

Thank you Erwin! I’ve made a test project in Mendix 7.23.4 myself (with security on) and now I see that when I navigate to the Home microflow using the menu option, the object made earlier is found. But when I press F5 or refresh the browser session by pressing enter at the URL in the browser, then the object is not found in the session anymore.

In my “real” project the user navigates away from the Home microflow to retrieve an OAuth token form an external website and is then redirected to the Mendix site again. In that situation apparently the session data is lost.

I will solve it by storing the counter in the database and have it cascading delete with the session.

answered
0

We have the same issue in our current project. In our navigation flow we retrieve an NPE object over the current session which finds nothing. If empty we create the NPE object and associate it to the user. When executing the same microflow we find multiple NPE objects, meaning the create DOES work but the retrieve DOES NOT work in the navigation microflow. The same applies to retrieving and associating the NPE object to the user. Any ideas? Mendix version 7.23.7

answered