I am new to Apex trying to do some practice assignments and have gotten stuck on this junction object query.
Task: Edit the current getUser() method to do the following:
Return a custom object (that you define in the class) with the current getUser method's query data, and the list of teams the person belongs to (by querying the team assignments).
- Parent Object 1: User (Standard Object)
- Parent Object 2: Team (Custom Object)
- Junction Object: Team Assignments (Custom Object)
**Original Class & getUser Method**
global class CTI {
global class CTIException extends Exception {}
global static User getUser() {
return [SELECT Id, Name, ProfileId, Profile.Name, UserRoleId, UserRole.Name, Username
FROM User WHERE Id = :UserInfo.getUserId() ];
}
}