ACR Rules

  1. Home
  2. Docs
  3. ACR Rules
  4. Reliability (41)
  5. Variable CurrentUser should only be used in a user context

Variable CurrentUser should only be used in a user context

Microflows in Mendix have access to two special variables, currentUser, and currentSession. The value for these variables is based on the user that initiated the microflow by clicking a button for example.
However, microflows can also be initiated by the system such as in scheduled events or integration endpoints such as rest.

When microflows are called by the system the value for currentUser and currentSession is empty so they should not be used.

Noncompliant example:

(assuming a microflow called from a scheduled event)
if $currentUser/HasFlag then 'Foo' else 'Bar'

Compliant example:

Not using the currentUser or currentSession variable in any way in microflows called by the system.