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
SimplySfdcSimplySfdc 

relationship Event to Account

Hi,

Why I cannot link Event to Account in relationship query, such as: Event.Account.Name ?

sq
Sumitkumar_ShingaviSumitkumar_Shingavi
You need to do it like
Event.WhatId = Account.Id
If this answer you question then mark it as solution.
SimplySfdcSimplySfdc
wow, after more than 6 years someone reply :)
but that is not the answer, I was asking for soql query, not in apex code
I think should be this
Select e.AccountId, e.Account.Name from Event e

 
Sumitkumar_ShingaviSumitkumar_Shingavi
I think your query will do half job! It should be
SELECT e.WhatId, e.AccountId FROM Event e
as Account Id can be any of the WhatId/AccountId on event record. If you want to do more manupulations then you need to get those WhatIds and AccountIds in a Set<Id> and fetch Accounts for those Ids to do further manupulations.