Current user in Native

0
Hello,  I’m wondering how to set up “currentUser” in Mendix React Native app? I want microflows/nanoflows to have “currentUser” and “currentSession” variables, but in Native both values are empty. Thanks in advance
asked
2 answers
1

I usually configure the native sync options (in the native navigation profile) to sync only the Account that matches the current user. So the native device will only have one Account in the database. Just do a Retrieve First in your nanoflow to get that account.

 

For the session: There is no current session as the native app only connects to the backend for synchronization. On your home page, you can use a datasource nanoflow to create an object of a non-persistent entity. Make sure to pass it along to every page you open and create associations to persistent entities where necessary. That gives the user the perception of a session. You could also make that entity persistent if you wish, make sure to attempt to get the existing object if it exists in that case.

answered
0

This works, but now the problem is the access rule. For example, I have entity MyEntity which have access rule [Module.MyEntity_Account = '[%CurrentUser%]'], and I cannot simply retrieve that entity. Any thoughts?

answered