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
Tai Rahman 10Tai Rahman 10 

SOQL Across Objects

Hello,

Was wondering if anyone could advise on how to edit the query below to show the name of the person who created the Event:

Select 
Id, AccountId, ActivityDate, Assigned_to_Role__c, Account.Name, Type, CreatedById
From Event 
Where AccountId != NULL  
and Type != NULL
Order by ActivityDate DESC LIMIT 100

Any help would be greatly appreciated!

Thanks,
Tai
Best Answer chosen by Tai Rahman 10
ShirishaShirisha (Salesforce Developers) 
Hi Tai Rahman,

Greetings!

Please use the below SOQL query to get the Name of the user.
 
Id, AccountId, ActivityDate, Assigned_to_Role__c, Account.Name, Type, CreatedBy.Name
From Event 
Where AccountId != NULL  
and Type != NULL
Order by ActivityDate DESC LIMIT 100

which returns the name of the user instead of Id.

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri

All Answers

ShirishaShirisha (Salesforce Developers) 
Hi Tai Rahman,

Greetings!

Please use the below SOQL query to get the Name of the user.
 
Id, AccountId, ActivityDate, Assigned_to_Role__c, Account.Name, Type, CreatedBy.Name
From Event 
Where AccountId != NULL  
and Type != NULL
Order by ActivityDate DESC LIMIT 100

which returns the name of the user instead of Id.

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
This was selected as the best answer
Tai Rahman 10Tai Rahman 10
Awesome, thanks so much Shirisha! 
Tai Rahman 10Tai Rahman 10
Also, apologies for the basic question, but any chance you could point me to the resource that showed you how to query for the name? Thanks again!