
For Example: Under Activities we have "Assigned To" lookup field for User object. IF I try to get its value using its API name (i.e. OwnerID) I will get SalesforceID of assigned user. My requirement is to get the actual Name.
Is it possible using a workflow (preferably) or can I get this by using a trigger.
1 件の回答
Where you are getting OwnerId in SOQL just put one more field Owner.Name, it will give you the name of the owner.
Like this you can fetch any field from the reference field. For example : if I need to get the owner name of account
List<Account> acc = [select ownerId , Owner.Namefrom account limit 1] ;
system.debug('acc :::: ' + acc[0].
Owner.Name) ;Regards
Ankit Arora | Certified Developer
_img src="http://1.bp.blogspot.com/-6or5Qdjdlpc/TfWeKZIQ9fI/AAAAAAAAADY/QJOxPzAaUt0/s170/Ankit-FB.png" /_ _img src="http://3.bp.blogspot.com/-_zrHcu18xjM/TfWeOWM2vAI/AAAAAAAAADg/IwJ3z3NEbEg/s170/blogger_logo50.jpg" /_ _img src="http://1.bp.blogspot.com/-ycM-M1F5peQ/TfWfPIx9dTI/AAAAAAAAAEA/5vmr179iJQA/s170/linkedin_logo.png" /_ _img src="http://1.bp.blogspot.com/-OZJJ4xf2KII/TfWedGqxZpI/AAAAAAAAAD4/26hAR7HTd8o/s170/twitter-logo.png" /_ _img src="http://3.bp.blogspot.com/-I9YdeYGmhIQ/TfWgJKbnDAI/AAAAAAAAAEU/DbTt-vKOjuQ/s170/bug_blue_normal.png" /_