59
Views
2
Comments
Default username client variable holds user's name
Question

When creating a new reactive web app from scratch, it comes with a Username client variable. This gets its value through a series of default common generated elements: Common flow > UserInfo block > OnInitialize client action > JavaScrcipt "$actions.GetUsername();" > GetUsername client action > GetUserNameFromServer data action > UserName output


Up until a few days ago, this data action actually returned a user's username, but now it returns the user's name. I believe this is because the Users default dependency used to have a User_GetUserName client action, and in the most recent update to this dependency this action has been replaced with User_GetName. This has caused the GetUserNameFromServer data action to replace the old User_GetUserName action with the new User_GetName server action, which in turn causes the Username client variable to store the user's name instead of the username.


Alternatively, the client action was always named User_GetName with a Name output, but it actually returned the username. Otherwise, I can't explain why the Username client variable suddenly contains the name instead of the username.


Is this working as intended? I can only assume the change was made so that the default UserInfo block would show the name instead of the username. The problem is that I have an app that depended on the Username client variable actually storing the username, and it took me a while to figure out why the app suddenly broke down and wasn't recognizing logged in employees.

mvp_badge
MVP
Rank: #76

Hi Matei,

I'm not sure why you think this was changed, as far as I know the Username client variable was already filled with the User.Name (and not the User.Username) attribute value. 

Looking at the documentation of the Users API, it is mentioned that the User_GetName server action is supposed to return the name of the logged user (not the username of the logged user).

I do think that it is a bit misleading that a client variable with the name 'Username' is populated with the name of the User and not the Username. I would expect it to be named Client.User_Name (or something more logical) to make it more clear that it is populated with the User.Name instead of User.Username.

Regards,

Nordin

Rank: #9351

My app has an Employees entity, and the Employee record for the logged in user is pulled through the username associated with it. The aggregate pulling the record has been filtered using the Username client variable for the past month, and it correctly used the username value. Also, the UserInfo block on the right side of the top menu always showed the username ever since I started using OutSystems in June.

Today I was looking at updating default OutSystems components in my environment, e.g. OutSystems UI, and refreshing dependencies in my app. I noticed that the Users dependency also requried a refresh, and after that the Username variable started storing the name value instead of the username.