function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
hegde_hegdekhegde_hegdek 

how to get username from ownerid

Hello Friends,

how do i get the username from ownerid,do i query the user table with id matching with the

owner id

regards

hegdek

Best Answer chosen by Admin (Salesforce Developers) 
mikefmikef

You can do it that way or this way.

 

String userName = [select Owner.UserName from Sobject where Id = '{Some Id}'].Owner.UserName;