Tags

,

To fetch Role and Profile name for the logged in user in APEX, use the following SOQL:

SELECT UserRole.Name, Profile.Name FROM User

Please note that UserRole and Profile are lookup fields in User object.