Please refer to UserTeam page
I have set TeamID and UserID as the unique attributes, and dropdown tag as the selection in assign the team. However, if I select more than one team for one user and there is at least one duplicate team, Save action is terminated.
What I expect:
Even there is duplicated record in the selection, the system can skip the duplicate one and save the rest of them.
Karen Lau is unduplicated record and I would like to save successfully on it. and the message maybe just advise when team is duplicated. Kindly advise on the solution.
hi @Winnie Lam ,
When you are saving team details, do foreach for list of teams selected for user then in that check if record with user and current team is already exist in database. if it exists then skip that record and if does not exist then create the record in database with user and current team.
PFA OML.
Regards,
Pramod.
Hi
Before inserting, do check whether the team is already been mapped to user and then insert.
Thanks
Hello Winnie,
This depends on you are saving the data in database entity. In your logic you are trying to save all records one after the other without committing the transaction. This way all the CreateUpdate are treated as part of single transaction, therefore if one fails all others fail too.
What you can do is introduce logic before CreateUpdate to check if current User-Team pair already exists
Hope it helps!