Hello,
i have a form where a registered user can fill in with his/her details. But it is unnecessary to fill in the same details everytime you fill in the form. So i was wndering how i can save the details of the current user automaticly everytime the user clicks on the "Save" button on the form. It needs to retrieve the current users details form the outsystems.com/Users page. Is this possible?
This is action of my save button:
Samed Gurses wrote:
Diksha Wadkar wrote:
Hello Samed ,
You can store current user data in database by using following steps.
1) Fetch user data using aggregate and put filter on it User.id=GetUserId()
2) Assign aggregate values to Create action of your entity .
Hope it helps !
Thanks & Regards ,
Diksha Wadkar
Hi Diksha,
the problem is that i dont know what to choose for the variable and value:
the second one, is this going the right way?
Hello Samed,
If you want to store current logged on user id in second assignment then you can directly use
GetUserId() build in function in second assignment .
Hope It Helps !
Hello Diksha,
Actually the items i want to store are : email, name and mobile phone number. Should i make 3 different assignments then? And what should i choose for the value?
Please check the following flow diagrams
I have fetched user data using aggregate and i have filtered data of current user .
And createuserdata2() this is my dummy entity action for storing data .I have created entity user2 .
Please check below diagram for assignment .
Is it also possible to prefill the input fields? So that the input fields have a initial content allready with for example email of the current user filled in the input?
Yes it is possible .
You need to set input field variable as aggregate value of current user .
i did that but than the email adress and other details are not correctly passed to the database:
you see for example that the email adress is empty, however it was pre filled with currents users email.
Yes, you can save the current logged on user details on DB without entering it. Just use an assign widget before saving the data and assign current user's Id by using built in function GetUserId() .
You can also get the User's name or Username by using GetUser(GetUserId()).User.Name , GetUser(GetUserId()).User.UserName respectively.
Hope it helps!
Regards,
Sanjay
Sanjay Kumar Sahu wrote:
I allready have a assign so i need to add a new one. But the problem is that i do not know what to select for the variable and value. I have this right now, the second one:
Is this good? What should i choose for the value
Hi Samed
If your need is to edit the default platform user, see the actions below that can be useful.
Regards.