I am using External Database in my web application.

For User Information i am using Out-system Database (System => User Table)

When I create or modify records in external database i am storing user id value in tables.

Currently i am using GetUserId() function in all the places.

Which one will be the best approach for this.

When the user logged in keep the User id in Session


directly use GetUserId() in create/update records


I saw this thread today


I assume GetUserId() === Session.UserId

Please correct me if i am wrong

Thank you,



In P10, we now use GetUserId(). It returns the ID of the user that is logged in the system.
It replaces the Session.UserId that existed in P9.

Eduardo Jauch

Hi Jauch,

So GetUserId() Internally retrieve the user id from session variable?

I have one more doubt.

Like List.Clear() do we have any inbuilt method to clear Record?


Hi Sekar, 

I would say yes, but I'm not sure the UserId is stored in a "session Variable in the same sense as the Session variables we create (but for sure is a defined per session).

Regarding the second question, I'm not aware of a "List.Clear()" method in OutSystems.
I know a ListClear action, that will remove all items from a list.

If by "clear record" you mean to reset all the attributes of a record variable to its default values, you can use a local variable of the same type (lets call it "empty"), and assign it to the record. This way, as the "empty" variable is an empty record, and you are copying its content to the record, the record values will be wiped out.

Eduardo Jauch

P.S. It is better to avoid asking unrelated questions in the same topic. Different questions, different topics. Better for you and for others searching the forum. :)