You're falling into a trap common with developers coming from other data modeling paradigms that use foreign keys. Instead, in Mendix, you should be using associations between your entities. Your list view entity generally should not have a "User ID" field.
So, I would recommend that you create an association in your domain model between Administration.Account (your user), and entity in your list view. Source the list view via XPath, and set the XPath constraint to something like this:
[MyEntity_Account = ['%currentUser%']]
You could source your list via microflow. Within the microflow you retrieve using Xpath and return the list.
First I would check off the "Store 'owner'" System members in the entity in the Domain Model:
Then, set your listview's Data Source as a microflow. In that microflow, try doing a Retrieve from Database, set the entity to whatever entity has the UserID attached to it, and set the XPath to something like [System.owner = $currentUser]. Finally, set the return object(s) to the retrieve from database list.
You can use an XPath constraint, depending on what kind of "return" objects you would like to add to the list.
Please visit https://docs.mendix.com/refguide7/xpath-constraint-functions and look at the different constraints you can use.
Thank you for your answers, that's o good solution, but i have also an other error. How can I set the return objects to the list ?
This is my example
I used XPath method but it didn't work. On the image below, ApproverID is a column in my table that contains the login of the user. I want to display on my List View just the items corresponding to the user connected to my application.
I used XPath but it didn't work. On the image below: ApproverID is a column in my table that corresponds to the login of the user connected to my application.
I want to display on the list view just the items corresponding to this user.
I have tried all these solutions, but it doesn't always work,
The problem is the syntax of the xPath, the field 'ApproverID' is a string and the currentUser is an object 'System.User'
Someone has an answer?
try [id=ApproverID] as Xpath Constraint.
Maybe this works.