30
Views
4
Comments
Solved
Assign a default value (username) to a database field
Question
Application Type
Reactive
Service Studio Version
11.51.3 (Build 57387)
Platform Version
11.14.0 (Build 34092)

Hi guys, how are you?

I'm new to the Outsystems platform and i'm having a problem that i think is quite basic :).

Basically i have a form that comes from an escafold of a table to record values.

This is the structure:

What I need is that when this form is saved and the userid field is automatically filled with the user who is currently logged in

Best Regards, and tks for your help

2021-06-02 20-50-04
Márcio Carvalho
Solution

What do you want to do? Display the UserId of the current User on the screen?

I can display, dont you?

EDIT: Anyway, i think i know what you want.



You need to do this

As you can see is now saving the UserId

Regards,

Márcio

2021-06-02 20-50-04
Márcio Carvalho

Hello there!

You need to use this function to get the current user id and assign it to the variable that you are using to update the record.

This is the function.

GetUserId()

So you use the assign and do this: GetPedidoById.List.Current.Pedidos.UserId = GetUserId(), if you are using the aggregate to store the data that you want to insert to the Pedidos entity. This without seeing what you are doing :D

If this doesn't work, please share if you can the OML.

Let me know if this helps you :)

Regards,

Márcio

UserImage.jpg
Helder Rocha

Hi Marcio, tks for you quick reply.

I am already doing something like that

And i tested a variable on the front-end

My problem here is i want to store this user id when i save this form.

oml atached :)

Best

SkreyHR.oml
2021-06-02 20-50-04
Márcio Carvalho
Solution

What do you want to do? Display the UserId of the current User on the screen?

I can display, dont you?

EDIT: Anyway, i think i know what you want.



You need to do this

As you can see is now saving the UserId

Regards,

Márcio

UserImage.jpg
Helder Rocha

It worked perfectly, that was it Marcio.

Thank you very much for your help´

Best
HR

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.