Hi,
I am trying to figure it out how can I connect a created user inside the:
https://outsystemscloud.com/Users
with the default entity Users.
I just want that when that particular user connects, he will be able to have access to data only related to his user, and when another user connects the same happen and they do not interfier with each other.
I already create an User inside the outsystemscloud.com/Users
Would any one be so kind and enlight me?
kind regards,
Pedro Boffa
Hi Pedro,
The information that is in users link can be queried within the User's entity in the the System object.
Please see the image below.
You can then use the getuserid() function to get the information for the logged user and show the data you want.
See if the link helps.
retrieving-current-user-logged-in-discussion
Hi @Samuel Anjos ,
Thank you for your answer.
That link helped a lot, but even tho I think I am still not quite sure how Am I going to do it.
I have a Player entity and this is the connection:
Ok, now lets say I create an user that never played my game.
How can I tell to the game: Hey create another player row for this user and he can only use this row.
I create a start screen for tests.
This is an enclosed if and if the user clicks on create your character it would lead it to an action:
My Idea here is:
* if you already played the game you can click on enter the game and it will open your last saved game.
*if you never played the game, only CREATE YOUR CHARACTER would appear and if the new user click there, it would also enter the game but would create a new row inside the player entity only for this user.
I would very happy to acomplish that, as that is the only thing that is in my way to finish the mini game.
My agreggate:
and the filter:
And the Idea here is that I have all those connections:
And when a new user goes inside the game, it should create a new player row inside the player entity, and already create 1 of each animal and associate those animals to that new user.
But when I click on the Button create your character, that happem.
new row is created and with no animal assigns!
Thank you in advance.
Kind regards,
Hello Pedro,
When creating your Player you should also create 1 of each Animal and associated it with the Player entity so that the id appears on the Players row.
Hope it helps!
Paulo Rosário
Hi @Paulo Rosário ,
This is not the only problem that I am having. I also have the problem that now new rows are being created.
And I think I already made those connectios you said if you check the second image in my first post message.
Can you please share a screenshot of your Player_CRUD action?
Best regards ,
@Paulo Rosário ,
Before doing all the changes I showed in the first post, it was working fine but if I logged with any acc it would use always the same row.. but now its creating new rows when I made all the changes you can see in the pictures above in the first post.
According to your screenshot you are not creating a record of each animal when creating a new Player, for that, you should use the CreateOrUpdate functions of each animal to populate that field in the Player Entity.
You are also not associating a User Id with your Player ( User Id in the Player entity is empty ) after using the GetUserId() function assign it to the Player.UserId field.
This is important because when you call the aggregate and filter for Player Only With Users and the filter for User.id = GetUserid() that aggregate will return an empty Player record which then if used on the CreateOrUpdatePlayer function will create a new and empty Player record ( Player.id will be empty ).
Hope it helps !
Thank you very much again for your answer.
Later after work I will check what you said and I will post here a feedback,
I tried some stuff here but still cant understand how I am going to do that.
Would you mind to be more clear? I am still a junior/Beginner and sometimes is not so clear.
This is what I created after what you said:
And My entity has already an User Id with my Player:
So I do not need that filter?
If not, do I need any filter?
Also this is my client action that I am using when I click a button the game start and a player should be assigned to a user. At least that is the goal.
I also have another question. When I login with a User I created, the entity user is populated with my user? Or I also need to do something for that to happen?
This is my User entity:
I also cant delete those records dont know why.
And also I have some that was created empty!
And that appears there, I dont know if I would see the ID even if that was working:
I tested and still not working like that!!
I already resolved the problem.
I just created a new User Entity where I can control things better instead of using the default one.
Now it is working, that was the problem.
Thank you.