+ Start a Discussion
Teach_me_howTeach_me_how 

Compare the role of two users. How can i know who among them has the higher role?

How can i do this in apex(Class/trigger)?

RoyGiladRoyGilad

Hi,
Depends on how you define higher...
If you count number of levels from your highest role - you could count the number of levels using \ based on  'Find My Salesforce Users by Role Hierarchy' by Jeff Douglas:
http://blog.jeffdouglas.com/2011/02/15/find-my-salesforce-users-by-role-hierarchy/

And compare the counters.