Finding Userid

  

I need to know the userid of the app user.  Is there a way to find this when the user is created.  This way I know when "Bob" is created I have his userid to assign customers too

If the user is logged in, server side the Id is known. You could create a server side action that returns it, and store it locally.

Thanks for the response.  What I am looking for is to learn what the UserId is when it is assigned on the server side

Hi,

On version 10 you have an action GetUserId(). Before that you can get it on Session.UserId. In both cases this is the Id of the user that is logged in.

Regards,

Marcelo

Instead of knowing the userId so you can assign customers to it, why not create a page with all users where you can assign Customers to them?

- Or a page with all Customers where you can add Users to them.



Users are found within System in the User entity.

Let me rephrase this.  I have a list of customers.  All users have access to these customers.  I would like to know who creates records using the customer and then be able to send user/customer specific information back  to the user .I know I can use the userid but where is it created?  Where can i view it?  Right now my user id's are stored in the sqlserver table.  I would like to migrate these to the outsystems database.  

As you can see, using userid does not help.  Is there a way to use the username as a session variable?


Hi! Andrew, 

If you look at the session variables you'll find the "Username" already there. 

Regards 

Graça

Hi Andrew,

In Outsystems all the Users are stored on the Users table inside the System. What you can do is to have a field called CreatedBy. This field can be of type text and store the username. As Maria said you can get the username on the session variable.

I didnt understand when you said that your user id's are stored in the sqlserver table. Can you explain it better?

Regards,

Marcelo

Hello Andrew,

I think we should clarify some things. I'll give you 2 scenarios, one, the default, the other, the one that it seems your case, by your comments.

1. You have an external database, but everything runs under OutSystems (no other app creating records in the external database). The user logs in the OutSystems app, create records in the external db and you use the GetUserId() to save the UserId there as well. If you need to find inf about the user, just filter Users or any table with a UserId field to fetch the info you want.

2. You have an OutSystems that is fetching data from a database that IS managed by another app that create records there, using its own Users system. Now, if both users are the same (other app and OutSystems), you will have to "map" the ids of the other app to the ids of the OutSystems users table (user). This map is an Entity that have a field for the other app user id, and a field to the OutSystems user id. So, once the mapping exists, you can use to find information on both sides.

How you do this mapping? Or manually, or you import the users from the other system (name, username, and id, for example), and create the user in the OutSystems side.

And how the UserId is created in OutSystems?

The User.Id is an autonumber, so when you create a new user in the User entity, a number is automatically given to him. You can create the User using the CreateUser entity action, and it will teturn to you the id created, or you can later filter the User entity by the username and find the id, for exame.

Hope this helps.

If not, than would be nice to have a bigger picture of your application, so we can understand the problem.

Cheers

Eduardo Jauch

OK. Last try.  When a user is created in the users section  "outystems.com/users".  How am I able to view the user id without having to have them log into the app and viewing it there.  I am talking app users not developers.  I need to know each users id before I am able to deploy the app.

If I set up a user "Bob Johnson" on the user set up page. where in the developer suite can I find the user id for "Bob Johnson"

That's all i need

Men...
Why didn't you asked before? :P haha

Just click in the user to go to Users Detail and look in the browser address bar. The Id is there.

Or go to any eSpace and select View Data in the User entity, set a filter for the user you want, and look to the Id.

Or just make an app, drag the User entity to the Flow, and add the Id field to the Table records...

Cheers,

Eduardo Jauch

That's exactly what I was looking for!!!!!!!!!!!!!!!!!!!!!!!

I knew there had to be some simple solution.

For future refrence, how do I view the table data in the espace?

lol

Sorry for take so long, but the first question was not really very clear, and the comments only make it worse. lol
Now, looking back, your question WAS clear, but in an unclear way xD

Cheers,
Eduardo Jauch

Sorry, didn't saw your last question.

Open an eSpace, go to Data layer, click one entity with the right button and than in the context menu, clickk View Data

Than you can even set filters :)

Cheers,
Eduardo Jauch

In addition to the above, the Id values are typically hidden by Service Studio, you need to hover your mouse over the little blue indicators with a number in it and press "Show n hidden" (where n is the number):