$currentUser vs [%CurrentUser%]

$currentUser is the currently authenticated user, having type System.User. What is the difference between the token [%CurrentUser%] and the parameter $currentUser. id = '[%CurrentUser%]' id = $currentUser   This is a Followupquestion of https://community.mendix.com/index4.html
2 answers

$currentUser is an object of type System.User (and so, it you can inspect its attribute values e.g. $currentUser/Name,  you can change its attributes e.g. by adding a role to its UserRoles association and committing it etc).

[%CurrentUser%] is a token which is used in XPath expressions. When the query is executed, the token is translated to the GUID (id attribute) of the User object of the current user.


Hi Tim,

I am fairly certain, that they are both the same when used in an XPath constraint. The token is useful because you can use it outside of Microflows unlike the variable $curentUser. For example, in XPath security constraints in the domain model, and in page elements.