Retrieve from association returns empty for non-persistable entity
Even though in the flow in a previous retrieve action data is there in the association but after that when I’m performing another retrieve operation to fetch the data from that particular association , it is coming as empty. During debugging it I saw that in variable section there is data in the association but when I’m retrieving from that association it is coming as empty and it don’t happen every time , suddenly the problem appears and it’s stay there.
A couple of ideas:
is it a permissions issue? are the retrieves in different microflows?
has time elapsed between the two retrieves? if so, maybe the associated object has been deleted by the Mendix garbage collection process.
Hope that helps,
Attach the object to the user session. Then they will be destroyed when the user session gets destroyed. And this way you can retrieve them again from the current user.
Non Persistent Objects are kept as long as they are in the State that is maintained for the user by Mendix. So if I navigate away from a page that uses or displays the non persistent object, it will no longer be in the state and is then subject to garbage collection. For a more detailed explanation of State and garbage collection for non persistent objects, you can read this documentation page: https://docs.mendix.com/refguide/transient-objects-garbage-collecting#1-introduction