Use GetUserId to get the user_name corresponding to the GetUserId

Hello guys

I am struggling to get the name attribute from User entity using GetUserId,

anyone peeps to help me get this challenge correct...I don't want to display the current logged in userId but I need to display the current user_name that is associated with the current UserId

Solution

Hi siseko,

Try something like that:

GetUser(GetUserId()).User.Name

Regards!

Solution

Paulo Cação wrote:

Hi siseko,

Try something like that:

GetUser(GetUserId()).User.Name

Regards!

Hello Paulo,

I don't get it right,I have been trying to use the method you gave me.

Thanks so much


Hi,

Where are you trying to show the user name? If you try to put in an expression, you will see it. (if you have a logged in)

Regards!

Hello Siseko, 

I'll assume that you are using the Users table as the UserProvider for your application, you can check that here:


If so, you can indeed use the getuser() function that Paulo Cação mentioned.

You can do it in several ways, one for instance is to drag and drop an Expression to the screen where you want to show the user name and inside that Expression you just put it as this: GetUser(UserId).User.Name 

This UserId is a variable that you should fetch from your desired source, whether it is a TableRecords, an input parameter, etc.

Let us know if you managed to solve this.

Best Regards

Afternoon guys,

Got it Got it Got it...I'm so happy right now...thank you guys,thank you very much.

Regards!