I have an entity Complaint that has an attribute called CreatedBy, which should reference the login user that created it.

The web app has a form to submit a new Complaint and the CreatedBy field should be populated with some data to reference the login user (e.g. User Id, Username). However, I can't find any way to capture the login user and bind it to the CreatedBy field. 

Any help would be very appreciated.

Hi Jossean,


Try to work with this built in function.

However, you can check this forum post ( https://www.outsystems.com/forums/discussion/46867/retrieving-the-current-user-that-is-logged-in/ ) where they explain more optimized ways to do this.

Best Regards,

João Delgado

João Delgado wrote:

Hi Jossean,


Try to work with this built in function.

However, you can check this forum post ( https://www.outsystems.com/forums/discussion/46867/retrieving-the-current-user-that-is-logged-in/ ) where they explain more optimized ways to do this.

Best Regards,

João Delgado


Hi,

I know about the GetUserId function. I don't know how to use it exactly. I tried to update the CreatedBy field on the server action to save the Entity, but when I use the "Assign" task, I can find anything about updating the Complaint.CreatedBy field. I tried also adding an Input widget in the form with the variable set to CreatedBy and added attributes of type="hidden" and value=GetUserId(). 

Either approach does not work, the entity in the database still has an empty value on the CreatedBy field.


Jossean Rivera wrote:

João Delgado wrote:

Hi Jossean,


Try to work with this built in function.

However, you can check this forum post ( https://www.outsystems.com/forums/discussion/46867/retrieving-the-current-user-that-is-logged-in/ ) where they explain more optimized ways to do this.

Best Regards,

João Delgado


Hi,

I know about the GetUserId function. I don't know how to use it exactly. I tried to update the CreatedBy field on the server action to save the Entity, but when I use the "Assign" task, I can find anything about updating the Complaint.CreatedBy field. I tried also adding an Input widget in the form with the variable set to CreatedBy and added attributes of type="hidden" and value=GetUserId(). 

Either approach does not work, the entity in the database still has an empty value on the CreatedBy field.


You did it?



Leonardo Nascimento wrote:

Jossean Rivera wrote:

João Delgado wrote:

Hi Jossean,


Try to work with this built in function.

However, you can check this forum post ( https://www.outsystems.com/forums/discussion/46867/retrieving-the-current-user-that-is-logged-in/ ) where they explain more optimized ways to do this.

Best Regards,

João Delgado


Hi,

I know about the GetUserId function. I don't know how to use it exactly. I tried to update the CreatedBy field on the server action to save the Entity, but when I use the "Assign" task, I can find anything about updating the Complaint.CreatedBy field. I tried also adding an Input widget in the form with the variable set to CreatedBy and added attributes of type="hidden" and value=GetUserId(). 

Either approach does not work, the entity in the database still has an empty value on the CreatedBy field.


You did it?



Thanks a lot for your time, it works now.