33
Views
6
Comments
Solved
How to display names in screen when both are FK

Hello Everyone,

I have a entity named Team Leader in which i have FK of system User.

 In my system Users there are some who are roled as Leader and some as Sales Person, So on screen i needed both as dropdown menu when i assign them.

My need is I have a person with TeamLeader Role and 3 with salesperson Role, when my mapp salesperson with a single team leader then, when i log in with as team leader i want to see all invoices which are assigned salespersons to him.

I created a dropdown with help from other members in my previous question[It got deleted :(].

I'm able to assign the sales persons to leaders, but unable to show in screen, how can i get that?



How can i display the leader and user at same time,

and My main question remains same,

 when i log in with as team leader i want to see all invoices which are assigned salespersons to him. 

Thank you in Advance :)

2026-02-26 06-29-24
Rahul
 
MVP
Solution

Yes understood.

but you need to use User entity twise one for leader and one for user.

Like alias wise.

2026-02-26 06-29-24
Rahul
 
MVP
Solution

in that case pass the leader id or Leader name filter 

like TeamLeader.LeaderID = GetUserID()

2026-02-26 06-29-24
Rahul
 
MVP

Hi,

You need to use three aggregate like -

TeamLeader 

LeaderUser (User)

User 

and join should be like-

TeamLeader Only with LeaderUser 

TeamLeader .LeaderUserID= LeaderUser.ID

Teamleader only with User

TeamLeader.userID=User.id


LeaderUser entity represent Leader user and User entity represent Users.


Hope this will help you.


Regards

Rahul

UserImage.jpg
Dev Limbachia

Hello Rahul,

thank you for your help but my LeaderUser and User aggregates are one entity only, I have just changed names of FK in teamLeader entity.


2026-02-26 06-29-24
Rahul
 
MVP
Solution

Yes understood.

but you need to use User entity twise one for leader and one for user.

Like alias wise.

UserImage.jpg
Dev Limbachia

Thank you Rahul, 

It was just a small addition that I didn't catch, but thank you very much for your help and could you help me with one more doubt,

I mapped these sales persons with leader, 

My one more requirement is, when I log in as Leader then i should see the invoices of the sales person which are assigned to Leader

For eg. 


Dev1 is leader and jimesh, kala, and Nikhil are sales person assigned to him

so when i log in with Dev1 then I should see the invoices of jimesh, kala, and Nikhil also,

what filter should i apply I'm not understanding.

Thank you.

2026-02-26 06-29-24
Rahul
 
MVP
Solution

in that case pass the leader id or Leader name filter 

like TeamLeader.LeaderID = GetUserID()

UserImage.jpg
Dev Limbachia

Thank you Rahul,

I got the result with your help, thank you for your valuable time.

Thank you.

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