How do I get the User ID to display in another table?

Hi,

I am currently creating a traditional web where the users are able to upload products. I am trying to make it so that when a user uploads a product, it will get the current session's User ID and Username and then get displayed onto a table. Currently, I cant get the User ID and username to display as the ID is always 0. I've tried using a filter in the aggregate where Session.UserID is = to User.ID and Session.Username= User.Username. But whenever i create the product I cant seem to save the user ID into the table. Below are some photos of my website and the process behind it. I've also attached an oml file.  Any idea how i can go about this? 

Thanks




Solution

Hello Jonathan

You can get the ID of the current user using GetUserId(). This method will return the ID of the user that is logged in the session.

If you didn't log in, you don't have a "user" and the method will return 0.

Cheers.

EDIT: This means that when you create a record using CreateOrUpdate or Create, you need to manually set the UserId FK to the value of GetUserId(). Usually we use an Assign immediately before the action, setting up the attribute value into the record we are providing to the action.

Solution