+ Start a Discussion
sadik Shaiksadik Shaik 

Query editor result is different from apex debug log

This query Select Id,User.name,TeamMemberRole from AccountTeamMember where Account.Id ='accontID' in query editor gives username wrt user.name but when i run the same query in Execute Anonymous the debug log gives me Userid for User.Name. What do you guys think the reason is? Appreciate your help
Gulafsha MohammedGulafsha Mohammed
What is accontID? Is it a string variable? if so give Account.Id =:'accontID' instead of Account.Id ='accontID'
Please let us know if this helps.

Happy to help further.

Kindly mark this as solved if the reply was helpful.

Bhargavi TunuguntlaBhargavi Tunuguntla
Hi Sadik,

If you are using a debug statemnet to view the output, then you will only see the Ids, however, you will be able to reference the actual names. For example, if you had something like this
List<AccountTeamMember > acc = [Select Id,User.name,TeamMemberRole from AccountTeamMember where Account.Id ='accontID']; 
for(AccountTeamMember a:acc){ 
system.debug('### user name = ' + a.user.name); 

The debug statemnets would correctly display the User's name and not the Id.

Hope this will be helpful.