How to detect if current user Registered or Guest?

0
There is a shopping app, and there are 2 types of users: registered users and anonimous guests. Both types of users can make an order, and when they make an order, an account of the current user (or guest) should be associated with the order.  For registered local users it’s clear – I can associate the “Order” entity with “Account”  entity, and when the order is finished, I use a microflow to retrieve an account of the current user and link it to the order. But the Guest is a problem. A guest is not logging in, he just fills a short form, and when he saves it, a new object of the “Guests” entity is created. When he is ready to confirm the order we should somehow detect that the current user is a guest and not a registered user (for example by checking if $currentUser/Name = empty), and instead of “Account” entity object, associate the “Guests” entity object with the “Order”. But if there are multiple guests registered in the same time, how to pick the right “Guest” entity object from the pile, which is the one I just created? What is the best way to implement it?
asked
1 answers
1

You can use the [%CurrentUser%] XPath system variable to retrieve the current user.  Then use an inheritance split or check the user role of the Current User to see if they have an anonymous user role.

More info here:  https://docs.mendix.com/refguide/xpath-keywords-and-system-variables

answered