58
Views
9
Comments
Solved
Joining a team
Application Type
Reactive
Service Studio Version
11.54.51 (Build 63195)

I'm encountering a challenge. I want to add a function where users join a team by entering a team code. When creating a team, a team code must be given by the team creator. Now, I seek to enable users to join a team using this code and subsequently view all tasks associated with that team. How do I do this?



Tasky.oml
Screenshot 2024-03-31 132952.png
Screenshot 2024-03-31 132926.png
2023-10-31 07-36-11
Marlies Quaadgras
Champion
Solution

HI Mohamed


I have improved your application: 

- on the screen when you enter the application you can see tasks assigned to you. When you are assigned to a Team, the tasks of that team are shown.

- on the screen with the teams, i have added the TeamCode in the list. Here you can edit the team, but also add an taks.  Here you can also join a team when you know the code

- i have added some cancel buttons, maxrecords and i have added serveractions for createorupdate for teams and tasks. Then you don't expose the entities on client-side

- what needs to be done: a screen that shows all the tasks of a team.


I hope this works for you


Best regards, Marlies

Tasky.oml
UserImage.jpg
Mohamed Touzani

Hi Marlies,

Thank you very much for your help. It works as how I wanted it. 

2023-10-31 07-36-11
Marlies Quaadgras
Champion

Hi @Mohamed Touzani 


If you did use the User entity, create an UserExtension, a 1;1 entity with as PK the PK of the User Entity. In this UserExtension you create a FK to your Team entity.

In your screen (or webblock) where you edit your User, you can create a dropdown list of your teams.  The user can select one of the Teams.  In the Serveraction behind the save button, the TeamId in the UserExtension is update. Afterward you can make sure that the User can view all tasks associated  to that Team


Does that make sense for you?


Best regards, Marlies

UserImage.jpg
Mohamed Touzani

Hi Marlies,

I hope you're doing well, and thank you for your response. Here's what I'd like to achieve: When a user clicks on "Teams" in the top menu, they should be redirected to the "Teams" screen, where they can view all the teams they are currently part of. If they wish to join another team, they should click on "Join team", which will prompt a popup screen to appear. In this popup, users will be required to enter the team code. Upon entering the team code and clicking "Join", the user will become a member of the corresponding team. There is no screen where I edit my user.


Does this make sense to you?


Screenshot 2024-03-31 154412.png
2023-10-31 07-36-11
Marlies Quaadgras
Champion

In that case the data model stays the same

I would make a popup-webblock in which the User can type its team code. When the user click Join, in a serveraction the team record is selected base on the Code in an aggregate GetTeamByCode, then the Id can be stored in the UserExtension record.


UserImage.jpg
Mohamed Touzani

I'm still unable to solve the problem. When I click on 'Join,' I encounter this error message. 


Below is the process flow triggered when 'Join' is pressed: 


Here is the Entity-Relationship Diagram (ERD): 


I've attached the application for your review. Please feel free to examine my work and identify where the issue arises. 

Tasky.oml
2023-10-31 07-36-11
Marlies Quaadgras
Champion


I have added a working version. Hope this works for you.


Tasky.oml
UserImage.jpg
Mohamed Touzani

Thank you Marlies. The connection works, but the thing now is that when I enter the teamcode, there is no TeamId assigned in the UserExtension table. So if a user enter the teamcode in the popup and presses "Join" it adds in the table, but it doesnt show up on the overview screen of the user.

The table:


The screen:

2020-05-07 18-53-00
Rui Barradas
 
MVP

Hello Mohamed,

That is because you're not passing the TeamId correct value when you're saving the record in the database.

As I can see in the code, you're saving the input variable in here:

GetTeamsByUserId.List.Current.Team.Teamcode


But in the GetTeamsByTeamcode aggregate, you're filtering by a TeamCode variable, which is an input of the screen and it's empty.


That's why the TeamId value will be empty. You have to filter by the same variable which is bound to the input widget in the screen.


Kind regards,

Rui Barradas

2023-10-31 07-36-11
Marlies Quaadgras
Champion
Solution

HI Mohamed


I have improved your application: 

- on the screen when you enter the application you can see tasks assigned to you. When you are assigned to a Team, the tasks of that team are shown.

- on the screen with the teams, i have added the TeamCode in the list. Here you can edit the team, but also add an taks.  Here you can also join a team when you know the code

- i have added some cancel buttons, maxrecords and i have added serveractions for createorupdate for teams and tasks. Then you don't expose the entities on client-side

- what needs to be done: a screen that shows all the tasks of a team.


I hope this works for you


Best regards, Marlies

Tasky.oml
UserImage.jpg
Mohamed Touzani

Hi Marlies,

Thank you very much for your help. It works as how I wanted it. 

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